N = int(input()) A = list(map(int, input().split())) A.append(A[-1]) ans = 0 pre = A[0] for i in range(N): if pre == A[i]: ans += 1 else: pre = A[i + 1] print(ans)