n = int(eval(input()))

a = list(map(int,input().split()))

neighbor = 1

nei = []

for i in range(1,n):

    if a[i] == a[i-1]:

        neighbor+=1

    else:

        if neighbor >1:

            nei.append(neighbor)

            neighbor = 1

if neighbor >1:

    nei.append(neighbor)

ans = 0

for x in nei:

    ans += x//2 

    

print(ans)
n = int(eval(input()))

ans = 0

a = list(map(int,input().split()))

now = a[0]

cnt = 1

p = []

for i in range(n-1):

    if now == a[i+1]:cnt+=1

    else:

        p.append(cnt)

        now = a[i+1]

        cnt = 1

p.append(cnt)

for x in p:

    ans+=x//2

print(ans)

    

 
n = int(eval(input()))
a = list(map(int, input().split()))
neighbor = 1
nei = []
for i in range(1, n):
    if a[i] == a[i - 1]:
        neighbor += 1
    else:
        if neighbor > 1:
            nei.append(neighbor)
            neighbor = 1
if neighbor > 1:
    nei.append(neighbor)
ans = 0
for x in nei:
    ans += x // 2
print(ans)

n = int(eval(input()))
ans = 0
a = list(map(int, input().split()))
now = a[0]
cnt = 1
p = []
for i in range(n - 1):
    if now == a[i + 1]:
        cnt += 1
    else:
        p.append(cnt)
        now = a[i + 1]
        cnt = 1
p.append(cnt)
for x in p:
    ans += x // 2
print(ans)

+ans = 0 -neighbor = 1 -nei = [] -for i in range(1, n): -    if a[i] == a[i - 1]: -        neighbor += 1 +now = a[0] +cnt = 1 +p = [] +for i in range(n - 1): +    if now == a[i + 1]: +        cnt += 1 -        if neighbor > 1: -            nei.append(neighbor) -            neighbor = 1 -if neighbor > 1: -    nei.append(neighbor) -ans = 0 -for x in nei: +        p.append(cnt) +        now = a[i + 1] +        cnt = 1 +p.append(cnt) +for x in p: