spoj#PUCMM334. White Hats

White Hats

There is a number of people in a room (between 2 and 100), and each of them wears a hat which is either black or white. Every person counts the number of other people wearing white hats. You are given the number counted by each person. Print the total number of people wearing white hats, or -1 if count doesn't correspond to a valid situation.

Input

The first line is N, the number of persons.

Then N space separaten integers follow, each one denoting the number of white hats each person sees.

Output

Print the total number of people wearing white hats, or -1 if count doesn't correspond to a valid situation.

Example

Input:                              Output:
3 2
2 1 1

Input:
Output:
3 3
2 2 2

Input:
Output:
2 0
0 0

Input: Output:
2 -1
10 10