n=int(input()) A=list(map(int,input().split())) before=A[0] ans=0 if n%2==0 else 1 flag=True for i in range(1,n): if before!=A[i]: if flag: ans+=1 flag=False else: flag=True else: ans+=1 print(ans)