n = int(input()) A = list(map(int, input().split())) ans = 0 for i in range(n): if i%2 == 0: ans += 1 else: if i != n-1: if A[i-1] == A[i] and A[i] == A[i+1]: ans += 1 else: if A[i-1] == A[i]: ans += 1 print(ans)