## PUCMM334 - White Hats

no tags

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                                       22 1 1Input:                              Output:3                                       32 2 2Input:                              Output:2                                       00 0Input:                              Output:2                                       -110 10`