def zunda(): global cnt, f cnt += 1 f = 1 N = int(input()) A = list(map(int, input().split())) cnt = 0 f = 0 for i in range(N): if i == 0: zunda() elif f == 0: zunda() elif A[i - 1] == A[i]: zunda() else: f = 0 print(cnt)