Ok, so if you think of a tableView like an array, the purpose of the tableView(didSelectRowAt: ) method is to tell Swift what row was tapped bearing in mind that array elements are counted from zero.
The indexPath is a parameter that comes free with the tableView and the tableView is like an array that holds the data you are displaying to the user.
When the user taps on an element of the tableView, the detail view will present certain information. In order to know the total number of photos displayed in the tableView the tableView array size is required. So, vc.totalPictures = indexPath.count because the count function will return an integer equal to the number of elements in the array.
The purpose of selectedPictureNumber is to present to the user the index number of the selected photo out of the total number of photos. As people normally count from 1, but machines count array elements from zero, adding one to the indexPath.row will account for the discrepency.
If you write:
vc.selectedPictureNumber = pictures[indexPath.row + 1]
an error is sure to be thrown, because the computer will read this as:
"Go, to the pictures array and get me the element at index: indexPath.row + 1. Now assign that value to vc.selectedPictureNumber."
Since vc.selectedPictureNumber is defined as an Integer, the value of pictures[indexPath.row + 1] had better be an integer also otherwise, there will be trouble. In this case, pictures is an array of strings, meaning the code is attempting to assign a string value to a variable expecting an integer. Swift will complain about that and you will also be much happier assigning an integer.
I hope that helps.