How can i prove this ?

How can i prove that solution to this problem is atleast n-1 (n is total number of subjects)?
link to the problem is CodeChef: Practical coding for everyone