N = int(input()) A = list(map(int,input().split())) stack = [] for i in A: stack.append(i) if(len(stack) >= 3 and len(set(stack[-3:])) == 1): for _ in range(3):stack.pop() print(N - len(stack))