#!/usr/bin/python

try:
    while True:
        N = int(input())
        seq = list(map(int, input().split(' ')))
        if N == 1:
            print("1")
        else:
            c = seq[-1] - seq[-2]
            i = N-1
            while i >= 0:
                if seq[i] - seq[i-1] != c:
                    break
                i -= 1
            print(max(i+1, 1))
except EOFError:
    pass
