N = int(eval(input()))

a = [int(i) for i in input().split()]



result = 0

prev = -1

count = 1

for i in range(len(a)):

    if a[i] == prev:

        count += 1

        if i == N - 1:

            result += count // 2

    else:

        result += count // 2

        prev = a[i]

        count = 1



print(result)
from itertools import groupby



N, *A = list(map(int, open(0).read().split()))

print((sum(len(tuple(v)) // 2 for _, v in groupby(A))))

N = int(eval(input()))
a = [int(i) for i in input().split()]
result = 0
prev = -1
count = 1
for i in range(len(a)):
    if a[i] == prev:
        count += 1
        if i == N - 1:
            result += count // 2
    else:
        result += count // 2
        prev = a[i]
        count = 1
print(result)

from itertools import groupby

N, *A = list(map(int, open(0).read().split()))
print((sum(len(tuple(v)) // 2 for _, v in groupby(A))))

-N = int(eval(input())) -a = [int(i) for i in input().split()] -result = 0 -prev = -1 -count = 1 -for i in range(len(a)): -    if a[i] == prev: -        count += 1 -        if i == N - 1: -            result += count // 2 -    else: -        result += count // 2 -        prev = a[i] -        count = 1 -print(result) +from itertools import groupby + +N, *A = list(map(int, open(0).read().split())) +print((sum(len(tuple(v)) // 2 for _, v in groupby(A))))