factorials are not involved in this question at all; we don’t care about how the students are arranged — all we care about is what students are *in* the photo

suppose we *must* have the teacher in the picture and each of the students is either in the picture or out of the picture; then there are 2 possibilities for each student’s “in-picture-ness”

for 7 students, that’s a total of 2^7 =128 different groups that are possible; but we have to subtract 1 from this total, as the case where none of the students are in the photo is disallowed by the question statement

hence the answer is 127