Given n numbers. Write a program that finds the index of the 2nd occurrence of the number 1 among these numbers. Indexing starts from 0.
The first line contains a natural number, n(1≤n≤1000).
The second line contains n numbers separated by spaces, ai(1≤ai≤1000).
Output the solution in a single line. If the index does not exist, output -1.
3 2 1 1
2
3 4 3 1
-1
Login to be able to submit.