I found an interesting problem on https://www.codechef.com/problems/CNTFAIL:
It's year 2018 and it's Christmas time! Before going for vacations, students of Hogwarts School of Witchcraft and Wizardry had their end semester exams.
$N$ students attended the semester exam. Once the exam was over, their results were displayed as either "Pass" or "Fail" behind their magic jacket which they wore. A student cannot see his/her result but can see everyone else's results. Each of $N$ students count the number of passed students they can see.
Given the number of "Pass" verdicts that each of the $N$ students counted, we have to figure out conclusively, the number of students who failed, or report that there is some inconsistency or that we cannot be sure.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- The first line of each test case will contain $N$, representing the number of students who attended the exam.
- Next line contains  $N$ spaced integers representing the number of "Pass" counted by each of the $N$ students.

-----Output:-----
- For each test case, output the answer in a single line. 
- If the counts reported by the students are not consistent with each other or if it's not possible to predict the number of failed students from the given input, then print -1.

-----Constraints-----
- $1 \leq T \leq 50$
- $1 \leq N \leq 10^{5}$
- $0 \leq$ Count given by each Student $\leq 10^{5}$

-----Sample Input:-----
1
4
3 2 2 2

-----Sample Output:-----
1

-----EXPLANATION:-----
There are 4 students, and they counted the number of passed students as 3,2,2,2. The first student can see that all others have passed, and all other students can see only 2 students who have passed. Hence, the first student must have failed, and others have all passed. Hence, the answer is 1.

I tried it in Python, but could not do it. Can you solve it?
t = int(input())
for i in range(t):
 number_of_students = int(input())
 list_of_numbers = list(map(int, input().split(" ")))
 max_number = max(list_of_numbers)
 min_number = min(list_of_numbers)
 #max_number must smaller becuase if it is equal, it means one student
 #saw himself which can't happen
 #(max_number - min_number) is always 0 or 1
 if max_number < number_of_students and min_number > -1 and \
 abs(max_number - min_number) <= 1:
  #can't see himself
  sum_of_values = sum(list_of_numbers)

  if number_of_students == 1:
   print(-1)
  elif (sum_of_values%(number_of_students-1)) != 0:
   print(-1)
  else:
   print(number_of_students-(sum_of_values//(number_of_students-1)))

 else:
  print(-1)