SPOJ NOTATRI WA

http://www.spoj.com/problems/NOTATRI/. I amgetting WA for the following code. Please help me solve the error. I am not able to get which testcase the code is going wrong. I have first sorted and then used binary search. In binary serch I have modified it to detect repeated values so that part is working fine. Here is my code. http://ideone.com/5pl7af. Help me.