N = int(input()) A = [0] + list(map(int, input().split())) + [0] ans = 0 X = 0 Y = 0 for i in range(N+1): if A[i] != A[i+1]: X += 1 if Y >= 2: ans += Y+1 Y = 0 else: Y = 0 if A[i] == A[i+1]: Y += 1 if X > 2: ans += abs(X-2)//2 X = 0 if X == N + 1: print(X//2) else: print(ans)