A row of lockers was assigned codes in order. Some codes were reused across several lockers. Scanning from the first locker to the last, find the earliest locker whose code appears exactly once in the whole list. Report its 0-indexed position, or -1 if no code is unique.
Input format
Line 1: an integer n, the number of lockers.
Line 2: n space-separated integers, the locker codes in order.
Output format
A single integer: the 0-indexed position of the first code that occurs exactly once, or -1.
Constraints
- 1 <= n <= 40
- 1 <= each code <= 1000000