While going through some accepted solutions of the problem CNTFAIL which was asked in the Amritapuri ICPC Regionals. I found this particular solution to generate the following output for this particular case -

Input -

1

4

1 3 2 1

Output -

2

Expected Output -

-1

I think this is a valid test case as per the given constraints because no where in the problem statement it is mentioned that only 2 different values will be mentioned in fact we need to check for inconsistency. I would be pleased if anyone can verify this test case, also if this test case is right that means the test data for the problem was weak.