Liars

Time Limit: 1000 ms Memory Limit: 65536 KiB

Problem Description

The party consists of n people, some of whom are liars. Liar always tells a lie, while the others tell the truth.

People i states that "There are Ai liars in total."

What's the minimum possible number of liars in the party?

Input

       There are several test cases (less than 100).

For each test case:

The first line contains an integer n (1≤ n ≤ 10^5).
     The second line contains n integers A1,A2,……,An (0≤ Ai ≤n).

Output

        For each test case, output the minimum numbers of liars, or -1 for impossible.

Sample Input

2
1 2
2
2 2

Sample Output

1
-1

Hint

 

Source

qinchuan