Calculated as a rectangular square, there are m rows in the horizontal direction and n columns in the vertical direction, and there are 2(M+N)-4 on the outermost side, which is obtained from 2(M+N)-4=26, and M+N= 15.
The number of people is the largest when M and N are closest, so the number of people is the largest when m = 8 and n = 7, with 56 people.