import sys input = sys.stdin.readline n=int(input()) A=list(map(int,input().split())) flag=0 for i in range(n-1): if A[i]==A[i+1]: flag=1 if i+2