import random



n = int(eval(input()))

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



ans = 0

for i in range(1, n-1):

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

        ans += 1

        while(1):

            A[i] = random.randrange(10000)+1

            if A[i] != A[i-1] and A[i] != A[i+1]: break



if A[-1] == A[-2]: ans += 1

print(ans)
# coding:utf-8



import sys



INF = float('inf')

MOD = 10 ** 9 + 7



def LI(): return [int(x) for x in sys.stdin.readline().split()]

def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF(): return [float(x) for x in sys.stdin.readline().split()]

def LS(): return sys.stdin.readline().split()

def II(): return int(sys.stdin.readline())

def SI(): return eval(input())





def main():

    n = II()

    A = LI()



    res = 0

    for i in range(1, n):

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

            A[i] = 0

            res += 1



    return res





print((main()))

import random

n = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for i in range(1, n - 1):
    if A[i] == A[i - 1]:
        ans += 1
        while 1:
            A[i] = random.randrange(10000) + 1
            if A[i] != A[i - 1] and A[i] != A[i + 1]:
                break
if A[-1] == A[-2]:
    ans += 1
print(ans)

# coding:utf-8
import sys

INF = float("inf")
MOD = 10**9 + 7


def LI():
    return [int(x) for x in sys.stdin.readline().split()]


def LI_():
    return [int(x) - 1 for x in sys.stdin.readline().split()]


def LF():
    return [float(x) for x in sys.stdin.readline().split()]


def LS():
    return sys.stdin.readline().split()


def II():
    return int(sys.stdin.readline())


def SI():
    return eval(input())


def main():
    n = II()
    A = LI()
    res = 0
    for i in range(1, n):
        if A[i] == A[i - 1]:
            A[i] = 0
            res += 1
    return res


print((main()))

-import random +# coding:utf-8 +import sys -n = int(eval(input())) -A = list(map(int, input().split())) -ans = 0 -for i in range(1, n - 1): -    if A[i] == A[i - 1]: -        ans += 1 -        while 1: -            A[i] = random.randrange(10000) + 1 -            if A[i] != A[i - 1] and A[i] != A[i + 1]: -                break -if A[-1] == A[-2]: -    ans += 1 -print(ans) +INF = float("inf") +MOD = 10**9 + 7 + + +def LI(): +    return [int(x) for x in sys.stdin.readline().split()] + + +def LI_(): +    return [int(x) - 1 for x in sys.stdin.readline().split()] + + +def LF(): +    return [float(x) for x in sys.stdin.readline().split()] + + +def LS(): +    return sys.stdin.readline().split() + + +def II(): +    return int(sys.stdin.readline()) + + +def SI(): +    return eval(input()) + + +def main(): +    n = II() +    A = LI() +    res = 0 +    for i in range(1, n): +        if A[i] == A[i - 1]: +            A[i] = 0 +            res += 1 +    return res + + +print((main()))