import itertools n = int(input()) A = list(map(int, input().split())) cnt = 0 for k, g in itertools.groupby(A): if len(list(g)) == 1: cnt += 1 print(cnt)