Problem:
 Score : 200 points    Problem Statement Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000 .  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i -th slime from the left is a_i .
If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell.
How many spells are required so that no slimes will start to combine themselves?      Constraints  2 \leq N \leq 100  1 \leq a_i \leq N  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  a_1  a_2  ...  a_N       Output Print the minimum number of spells required.        Sample Input 1 5
1 1 2 2 2      Sample Output 1 2  For example, if we change the color of the second slime from the left to 4 , and the color of the fourth slime to 5 , the colors of the slimes will be 1, 4, 2, 5, 2 , which satisfy the condition.       Sample Input 2 3
1 2 1      Sample Output 2 0  Although the colors of the first and third slimes are the same, they are not adjacent, so no spell is required.       Sample Input 3 5
1 1 1 1 1      Sample Output 3 2  For example, if we change the colors of the second and fourth slimes from the left to 2 , the colors of the slimes will be 1, 2, 1, 2, 1 , which satisfy the condition.       Sample Input 4 14
1 2 2 3 3 3 4 4 4 4 1 2 3 4      Sample Output 4 4

Solution (Python):
n = int(input())
a = list(map(int,input().split()))

s = []
ap = a[0]
count = 0
for i in range(n):
    if ap == a[i]:
        count += 1
    else:
        if count > 1:
            s.append(count)
        ap = a[i]
        count = 1
if count > 1:
    s.append(count)

ans = 0
for x in s:
    ans += x//2
print(ans)

Solution (Python):

import sys, math, fractions, itertools, collections, copy, heapq


def solve(N: int, a: "List[int]"):
    res = 0
    c = -1
    if a[0] == a[1]:
        a[1] = c
        c -= 1
        res += 1
    for i in range(1, N-1):
        if a[i+1] == a[i]:
            a[i+1] = c
            c -= 1
            res += 1
    print(res)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    a = [ int(next(tokens)) for _ in range(N) ]  
    solve(N, a)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

l = a[0]
cnt = 1
ans = 0

for i in range(1, n):
    if l == a[i]:
        cnt += 1
    else:
        ans += cnt // 2
        l = a[i]
        cnt = 1

ans += cnt // 2

print(ans)

Solution (Python):
n=int(input())
da=list(map(int,input().split()))
co=0
no=-1
ko=0
ans=0
while co<n:
    if no==da[co]:
        ko+=1
    else:
        ans+=ko//2
        no=da[co]
        ko=1
    co+=1
ans+=ko//2
print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n-1):
	if a[i]==a[i+1]:
		cnt+=1
		a[i+1]=a[i+1]*3+10000
print(cnt)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
a.append(0)
ans = 0
count = 1
nm = a[0]
for i in range(1,N+1):
    if nm == a[i]:
        count += 1
    else:
        nm = a[i]
        ans += count//2
        count = 1

print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(1, n):
    if a[i-1] == a[i]:
        ans += 1
        a[i] = -1
print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

cnt = 0
for i in range(1, N):
    if A[i] == A[i - 1]:
        A[i] = 10001
        cnt += 1
print(cnt)

Solution (Python):
n = int(input())
a = [int(e) for e in input().split()]
p = a[0]
result = 0
for i in range(1, n):
  if p == a[i]:
    result += 1
    p = -1
  else:
    p = a[i]
print(result)

Solution (Python):
import sys
input=sys.stdin.readline

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

def runLength(s):
    a = []
    for c in s:
        if len(a)==0 or a[-1][0]!=c:
            a.append([c,1])
        else:
            a[-1][1] += 1
    return a

r = runLength(a)
ans = 0
for i in r:
    ans += i[1]//2
print(ans)

Solution (Python):
import math

n = int(input())
a = list(map(int, input().split()))
a.append("
start = 0
end = 0

ans = 0

while a[start] != "
  if a[start] != a[end]:
    x = end - start
    if x % 2 == 0:
      ans += x // 2
    else:
      ans += math.floor(x / 2)
  
    start = end

  else:
    end += 1


print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.append(0)
ans=0
t=a[0]
c=1
for i in range(1,n+1):
    if t==a[i]:
        c+=1
    else:
        ans+=c//2
        t=a[i]
        c=1
print(ans)

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]
last = 0
cnt = 0
for a in A:
    if(last==a):
        cnt+=1
        last = 0
    else:
        last = a
print(cnt)

Solution (Python):
n,a=open(0);print(sum(len(list(g))//2for k,g in __import__('itertools').groupby(a.split())))

Solution (Python):
from itertools import*;n,a=open(0);print(sum(len(list(g))//2for k,g in groupby(a.split())))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.insert(0, -1)
a.append(-1)
m = []
cnt = 0
for i in range(1, len(a)):
    if a[i] != a[i-1]:
        if cnt != 0:
            m.append(cnt)
        cnt = 1
    else:
        cnt += 1
total = 0
for i in m:
    total += i // 2
print(total)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

c = 1
ans = 0

for i in range(1, N):
    if a[i] == a[i - 1]:
        c += 1
    else:
        ans += c // 2
        c = 1
ans += c // 2

print(ans)

Solution (Python):
N = int(input())
A = [int(_) for _ in input().split()]

ans = 0
k = 1
for i in range(N-1):
    if A[i] == A[i+1]:
        k += 1
    else:
        ans += k // 2
        k = 1
ans += k // 2
print(ans)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

ans = []
count = 0
for i in range(0,N):
    if i == 0:
        count = 1
    elif i == N-1:
        if a[i] == a[i-1]:
            count += 1
            ans.append(count)
        else:
            ans.append(count)
            count = 1
            ans.append(count)
    else:
        if a[i] == a[i-1]:
            count += 1
        else:
            ans.append(count)
            count = 1
        
an = 0
for i in range(len(ans)):
    an += ans[i]//2

print(an)

Solution (Python):
import sys
sys.setrecursionlimit(100000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from copy import *

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

Solution (Python):

n = int(input())
num_list = [ int(v) for v in input().split() ]

multi_list = [[num_list[0]]]

for i in range(1,n):
    if num_list[i] == multi_list[-1][-1]:
        multi_list[-1].append(num_list[i])
    else:
        multi_list.append([num_list[i]])
    
print(sum(map(lambda x: len(x)//2 ,multi_list)))

Solution (Python):
a = int(input())
b = list(map(int, input().split()))
c = {}
d = 1
e = 0
for i in range(1, len(b)):
    if b[i] == b[i-1]:
        d += 1
    else:
        e += d // 2
        d = 1
print(e + d // 2)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
c=l[0]
ans=0
for i in range(1,n):
    if l[i]==c:
        ans+=1
        c=10001
    else:c=l[i]
print(ans)

Solution (Python):
n = int(input())
ls = list(map(int, input().split()))
ans = 0

for i in range(1,n):
    if ls[i-1] == ls[i]:
        ls[i] = -1
        ans += 1
print(ans)

Solution (Python):
a = int(input())
b = []
c = list(map(int, input().split()))
d = 0
for i in range(1, len(c)):
    if c[i] == c[i-1]:
        d += 1
    else:
        if d != 0:
            b.append(d+1)
            d = 0
if d != 0:
    b.append(d+1)
e = 0
for i in b:
    e += i // 2
print(e)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

count = 0
pre = False
for i in range(N-1):
    if a[i] == a[i+1]:
        if not pre:
            count += 1
            pre = True
        else:
            pre = False
    else:
        pre = False
print(count)

Solution (Python):
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
    
n=I()
a=LI()
ans=0
pre=None
for i in a:
    if pre==None:
        pre=i
        c=1
        continue
    if i==pre:
        c+=1
    else:
        ans+=c//2
        c=1
    pre=i
ans+=c//2
print(ans)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(N-1):
    if a[i]==a[i+1]:
        a[i+1]=(i+1+100)**2
        ans+=1
print(ans)

Solution (Python):
N = int(input())
a_list = list(map(int,input().split()))

cnt = 0
tmp_cnt = 0
tmp_a = 0
for a in a_list:
    if a == tmp_a:
        tmp_cnt += 1
        if tmp_cnt % 2 == 0:
            cnt += 1
    else:
        tmp_a = a
        tmp_cnt = 1
        
print(cnt)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

ans = 0
for i in range(n-1):
    if a[i] == a[i+1]:
        a[i+1] = 10000
        ans += 1
print(ans)

Solution (Python):
N=int(input())
A=[int(i) for i in input().split()]
check=10001
ans=0
for i in range(N-1):
    if A[i]==A[i+1]:
        A[i+1]=check
        ans+=1
print(ans)

Solution (Python):

from collections import defaultdict, deque
import math
from math import factorial
import fractions
import re

BIGNUM = 10 ** 9 + 7

def main():
    
    
    N = int(input())
    As = list(map(int, input().split()))
    As.append(100000)

    magic_num = 0
    prev = None
    seq = 1
    for a in As:
        if prev is not None:
            if prev == a:
                seq += 1
            else:
                if seq > 1:
                    magic_num += seq // 2
                seq = 1
        prev = a

    print(magic_num)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
tmp = max(a)+1
count = 0
for i in range(1,N):
    if a[i-1]==a[i]:
        a[i] = tmp
        count+=1
print(count)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
s=[]
i=0
c=1
while True:
  if i==n-1:
    s.append(c)
    break
  if l[i]!=l[i+1]:
    s.append(c)
    c=0
  c+=1
  i+=1
ans=0
for i in s:
  ans+=i//2
print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

ans = 0
pre = -1
cont = 1
for a in A:
    if a == pre:
        cont += 1
    else:
        ans += cont // 2
        cont = 1
    pre = a
if cont != 1:
    ans += cont // 2
print(ans)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
ans = 0
i = 1
while i < N:
    if A[i-1] == A[i]:
        ans += 1
        i += 1
    i += 1

print(ans)

Solution (Python):
n=int(input())
li = list(map(int,input().split()))
a=0
for i in range(1,n):
  if li[i] == li[i-1]:
    li[i] = 0
    a+=1
print(a)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
flg = 0
counter = 0
for i in range(n-1):
    if a[i] == a[i+1]:
        if flg == 0:
            counter +=1
            flg = 1
        else:
            flg = 0
    else:
        flg = 0
print(counter)

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]

ans = 0
flg = False
for i in range(1, N):
    if flg is False and a[i] == a[i-1]:
        ans += 1
        flg = True
    else:
        flg = False
print(ans)

Solution (Python):

def main():
    n = int(input())
    A = tuple(map(int, input().rstrip().split()))
    ans, flg = 0, False
    for i, j in zip(A, A[1:]):
        if flg:
            flg = False
        else:
            if i == j:
                ans += 1
                flg = True
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
slime = [int(x) for x in input().split()]
border = [0] + [i+1 for i in range(n-1) if slime[i] != slime[i+1]]

if len(border):
  border.append(n)
  count = sum([(border[i+1] - border[i]) // 2 for i in range(len(border) - 1)])
else:
  count = n // 2

print(count)

Solution (Python):
from itertools import groupby as g
n=int(input())
a=list(map(int,input().split()))
l=[[i,len(list(j))] for i,j in g(a)]
m=0
for i in range(len(l)):
  m+=l[i][1]//2
print(m)

Solution (Python):
N = int(input())
a = list(input().split())

cnt = 0
for i in range(1, N):
    if a[i] == a[i-1]:
        a[i] = 'x'
        cnt += 1
print(cnt)

Solution (Python):
import math
n=int(input())
a=list(map(int,input().split()))
cnt=0
ans=0
for i in range(n-1):
    if a[i]==a[i+1]:
        cnt+=1
    else:
        cnt+=1
        if 1<cnt:
            ans+=math.floor(cnt/2)
            cnt=0
        else:
            cnt=0
if a[-2]==a[-1]:
    cnt+=1
    ans+=math.floor(cnt/2)

print(ans)

Solution (Python):
from itertools import groupby

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

ans = 0
for key, group in groupby(A):
    ans += len(list(group))//2
print(ans)

Solution (Python):
n=int(input())
x=list(map(int,input().split()))
ans=0
for i in range(1,n):
    if x[i-1]==x[i]:
        ans+=1
        x[i]=-1
print(ans)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
    if a[i] == a[i + 1]:
        ans += 1
        a[i + 1] = -1

print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

n, count = 1, 0
while n < N:
	if A[n - 1] == A[n]:
		count += 1
		n += 1
	n += 1
print(count)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
a.append(0)
cnt = 1
ans = 0
for i in range(1,n+1):
    if a[i-1] == a[i]:
        cnt += 1
    else:
        ans += cnt//2
        cnt = 1
print(ans)

Solution (Python):
N = map(int, raw_input().split())[0]
A = map(int, raw_input().split())
kasanari = 1
c = 0
for i in range(0,N-1):
    if A[i]==A[i+1]:
        kasanari = kasanari + 1
    else:
        c = c + kasanari/2
        kasanari = 1
c = c + kasanari/2
print(c)

Solution (Python):
N = int(input())
a = input().split()

flg = False
old = a[0]

cnt = 0
for i in range(1,N):
    if a[i] == old and not flg:
        cnt += 1
        flg = True
    else:
        flg = False
    old = a[i]

print(int(cnt))

Solution (Python):
N = int(input())
a = input().split()

flg = False
old = a[0]

cnt = 0
for i in range(1,N):
    if a[i] == old and not flg:
        cnt += 1
        flg = True
    else:
        flg = False
    old = a[i]

print(int(cnt))

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]

answer = 0
for i in range(1,N):
  if A[i] == A[i-1]:
    A[i] = -1
    answer += 1
print(answer)

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    prev = 0
    ans = 0
    for a in A:
        if a == prev:
            ans += 1
            prev = 0
        else:
            prev = a
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
As = list(map(int,input().split()))
counts = []
now = As[0]
count = 1
for a in range(1,len(As)):
    if As[a]==now:
        count+=1
        if a == len(As)-1:
            counts.append(count)
    else:
        counts.append(count)
        count =1
        now = As[a]
print(sum([i//2 for i in counts]))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
cnt = 0
i = 1
while i<n:
    if a[i]==a[i-1]:
        cnt += 1
        i += 1
    i += 1
print(cnt)

Solution (Python):

"""
A - Colorful Slimes 2
https://atcoder.jp/contests/agc026/tasks/agc026_a

"""
import sys


def solve(N, slimes):
    prev = None
    ans = 0
    for s in slimes:
        if s == prev:
            prev = None
            ans += 1
        else:
            prev = s
    return ans


def main(args):
    N = int(input())
    slimes = [int(a) for a in input().split()]
    ans = solve(N, slimes)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())


N = int(input())
As = list(mi())

ans = 0
prevcolor = 0 
nowsectionsize = 0
for a in As:
  if prevcolor != a: 
    ans += nowsectionsize//2 
    nowsectionsize = 1 
  else: 
    nowsectionsize += 1 
  prevcolor = a 


ans += nowsectionsize //2

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

N, = map(int, input().split())
L = [int(v) for v in input().split()]
c = max(L) + 1

ans = 0
for i in range(N - 1):
    if L[i] == L[i + 1]:
        L[i + 1] = c
        c += 1
        ans += 1
        
print(ans)

Solution (Python):
n=input()
l=list(map(int,input().split()))
a,x=0,0
for i in l:
    if x==i:
        a+=1
        x=0
    else:
        x=i
print(a)

Solution (Python):
N = int(input())
slimes = input().split()
slimes = list(map(int, slimes))

count = 1
count_list = []
ans = 0

for i in range(N-1):
    if slimes[i] - slimes[i+1] == 0:
        
        count += 1
        
    else:
        
        count_list.append(count)
        count = 1
count_list.append(count)

for i in count_list:
    ans += int(i/2)
    
print(ans)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
t=0
l=1
B=[]
for i in range(N):
    if t==A[i]:
        l+=1
    else:
        B.append(l)
        l=1
        t=A[i]
B.append(l)
ans=0
for i in B:
    ans+=i//2
print(ans)

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]

count = []

flg = 1
for i in range(1,n):
    if a[i] == a[i-1]:
        flg += 1
        
        if i == n-1:
            count.append(flg)
            
    else:
        count.append(flg)
        flg = 1
        i +=1
cnt = 0

for j in count:
    cnt += j//2
print(cnt)

Solution (Python):
def ContinueCnt(A):
	Datas, Cnts = [A[0]], [1]
	index = 0
	for i in range(1, len(A)):
		if A[i] == Datas[index]:
			Cnts[index] += 1
		else:
			Datas.append(A[i])
			Cnts.append(1)
			index += 1
	return Datas, Cnts

N = int(input())
*a, = map(int, input().split())
Nums, Cnts = ContinueCnt(a)
ans = 0
for j in range(len(Cnts)):
	if Cnts[j] > 1:
		ans += Cnts[j] // 2
print(ans)

Solution (Python):
N = int(input())
*a, = map(int, input().split())

Nums, Cnts = [a[0]], [1]
index = 0  
for i in range(1, N):
	if a[i] == Nums[index]:
		Cnts[index] += 1
	else:
		Nums.append(a[i])
		Cnts.append(1)
		index += 1
ans = 0
for j in range(len(Cnts)):
	if Cnts[j] > 1:
		ans += Cnts[j] // 2
print(ans)

Solution (Python):
n=input()
l=list(map(int,input().split()))
a,x=0,0
for i in l:
    if x==i:
        a+=1
        x=0
    else:
        x=i
print(a)

Solution (Python):
n = [int(item) for item in input().split()]
a = [int(item) for item in input().split()]

prev = -1
ans = 0
for item in a:
    if item == prev:
        ans += 1
        prev = -1
    else:
        prev = item

print(ans)

Solution (Python):
n = int(input())
s = list(map(int, input().split()))

magic = 0
for i in range(1, n):
    if s[i - 1] == s[i]:
        magic += 1
        s[i] = -1

print(magic)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))+[10001]
magic=0
cnt=1
for i in range(N):
    if a[i] == a[i+1]:
        cnt+=1
    else:
        magic+=cnt//2
        cnt=1
print(magic)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
memo=10000
ans=0
for i in range(n):
    if a[i]==memo:
        memo=10000
        ans+=1
    else:
        memo=a[i]
print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
tmp,ans,cnt=0,0,1
for i in a:
    if i==tmp:
        cnt+=1
    else:
        tmp=i
        ans+=cnt//2
        cnt=1
ans+=cnt//2
print(ans)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

ans = 0
tmp = 0
cnt = 1
for x in a:
    if x == tmp:
        cnt += 1
    else:
        tmp = x
        ans += cnt // 2
        cnt = 1
ans += cnt // 2
print(ans)

Solution (Python):
n=input()
n=int(n)
a=input().split()
n=[int(i) for i in a]
b=0
count=0
for i in a:
    if i==b:
        count+=1
        b=0
        continue
    b=i
print(count)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
temp = a[0]
ans = 0
for i in range(n-1):
    if temp == a[i+1]:
        ans += 1
        temp = -1
    else:
        temp = a[i+1]
print(ans)

Solution (Python):
N=int(input())
An=list(map(int,input().split()))
c = 0
for i in range(1, N):
    if An[i] == An[i-1]:
        c += 1
        An[i] = (max(An[i+1], An[i-1]) if i < N-1 else An[i-1]) +1
print(c)

Solution (Python):

N = int(input())
a = list(map(int, input().split()))
ans = 0
tmp = 0
for i in range(N-1):
    if a[i] != a[i+1]:
        ans += (tmp + 1) // 2
        tmp = 0
    else:
        tmp += 1
ans += (tmp + 1) // 2
print(ans)

Solution (Python):
N = int(input())
aList = [int(x) for x in input().split()]

result = 0
for i in range(N-1):
    if aList[i] == aList[i+1]:
        aList[i+1] = -(i+1)
        result += 1

print(result)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

from itertools import groupby

ans = 0
for k, g in groupby(A):
  ans += len(list(g))//2
  
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

p = 1
b = []
for e, f in zip(a[:-1], a[1:]):
    if e == f:
        p += 1
    else:
        b.append(p)
        p = 1

b.append(p)

ans = 0
for e in b:
    ans += e // 2

print(ans)

Solution (Python):
n=int(input())
A=[int(i) for i in input().split()]
count=0
chg=0
for i in range(1,n):
  if A[i]==A[i-1] and chg==0:
    count+=1
    chg=1
  else:
    chg=0
print(count)

Solution (Python):
N = int(input())
a = list(map(int,input().split(" ")))

N += 1
a.append(0)
s = 0
m = a[0]
n = 1
for i in range(1,N):
    if m == a[i]:
        n += 1
    else:
        s += (n//2)
        n = 1
    m = a[i]

print(s)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
ans = 0
color = 10001
cur = 0
for i in range(n):
    if a[i] != color and cur == 0:
        color = a[i]
        cur += 1
    elif a[i] != color and cur > 0:
        color = a[i]
        if cur % 2 == 0:
            ans += cur//2
        else:
            ans += (cur-1)//2
        cur = 1
    else:
        cur += 1
if cur % 2 == 0:
    ans += cur//2
else:
    ans += (cur-1)//2
print(ans)

Solution (Python):
n=int(input())
arr=list(map(int,input().split()))
cnt=0
for i in range(1,n):
  if arr[i]==arr[i-1]:
    arr[i]='x'
    cnt+=1
print(cnt)

Solution (Python):

N = int(input())
a = list(map(int, input().split()))
count = 0
now = 0
ans = 0
for i in range(N):
  if a[i] == now:
    count += 1
  else:
    ans += count//2
    count = 1
    now = a[i]

ans += count//2
print(ans)

Solution (Python):
N = int(input())
a_s = [int(x) for x in input().split()]

ans = 0
start = 0
color = None
for i, a in enumerate(a_s):
    if color is None:
        color = a
    else:
        if color != a:
            ans += (i - start) // 2
            color = a
            start = i
ans += (N - start) // 2

print(ans)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]

l = []
pre = ""
cnt = 0
for x in a:
    if pre == x:
        cnt += 1
    else:
        l.append(cnt)
        cnt = 1
        pre = x

l.append(cnt)
l = l[1:]

print( sum(list(map(lambda x: x//2, l))) )

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(n-1) :
  if(a[i] == a[i+1]) :
    cnt += 1
    a[i+1] = 0
print(cnt)

Solution (Python):
n=int(input())
ans=0
a=0
for i in map(int,input().split()):
  if not a==i:
    a=i
    continue
  ans+=1
  a=0
print(ans)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
ans = 0
now = a[0]
i = 1
while i < N:
    if now == a[i]:
        ans += 1
        if i == N-1:
            break
        now = a[i+1]
        i += 2
        
    else:
        now = a[i]
        i += 1
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
l = r = 0
ans = 0
while l < n:
    while r < n and a[l] == a[r]:
        r += 1
    k = r - l
    if k > 1:
        ans += k // 2
    l = r
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = 0
pre = 0

for i in range(n-1):
    if a[i] == a[i+1]:
        if pre != 1:
            pre = 1
            ans += 1
        else:
            pre = 0
    else:
        pre = 0

print(ans)

Solution (Python):
n = int(input())
alist = list(map(int, input().split()))
preva = None
ans = 0
for a in alist:
  if preva is None:
    preva = a
  else:
    if preva == a:
      ans += 1
      preva = None
    else:
      preva = a
print(ans)

Solution (Python):
import numpy as np

N = int(input())
a = [int(_) for _ in input().split()]
List = np.array([])
tmp = 0
cnt = 0

for i in a:
    if i == tmp:
        cnt += 1
    else:
        List = np.append(List,cnt)
        cnt = 1
        tmp = i
List = np.append(List,cnt)

print(int(sum(List//2)))

Solution (Python):
n=int(input());a=list(map(int,input().split()));c,ans=1,0
for i in range(n-1):
  if a[i]==a[i+1]:c+=1
  else:
    if c>=2:ans+=c//2
    c=1
if c>=2:ans+=c//2
print(ans)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
b_color = -1
count = 0
for i in range(N):
    if b_color == a[i]:
        count += 1
        b_color = -1
        continue
    b_color = a[i]
print(count)

Solution (Python):
N=int(input())
a=list(input().split())
ans=0
i=0
while i<(N-1):
    if a[i]==a[i+1]:
        ans+=1
        i+=2
    else:
        i+=1
print(ans)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
color = 0
num = 1
count = 0
for i in range(N):
    if a[i] == color:
        num += 1
    else:
        color = a[i]
        if num >= 2:
            count += num // 2
            num = 1
    if i == N - 1:
        if num >= 2:
            count += num // 2
print(count)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))

ans = 0
changed = False
for a,b in zip(A,A[1:]):
    if changed:
        changed = False
        continue
    if a == b:
        ans += 1
        changed = True
print(ans)

Solution (Python):
n=int(input())
slime=list(map(int,input().split()))
stack=0
count=0
ans=0
for i in slime:
  if i!=stack:
    stack=i
    ans+=((count+1)//2)
    count=0
    continue
  count+=1
  stack=i
ans+=((count+1)//2)
print(ans)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
k = 0
cnt = 0
while (k <= N - 2):
  if (a[k] == a[k+1]):
    cnt += 1
    k += 2
  else:
    k += 1
print(cnt)

Solution (Python):
N = int(input())
A = [int(a) for a in input().split()]

pre = -1
c = 0
ans = 0
for a in A:
    if a == pre:
        c += 1
        if c % 2 == 0:
            ans += 1
    else:
        c = 1
    pre = a
    
print(ans)

Solution (Python):

'''
問題
この世界にはスライムの色が10000色ある
左からiつめのスライムの色はai
スライムがN体1列に並んでいる。Nは2以上100以下
隣り合う色のスライムが同じにならないようにスライムの色を変えたい。最小で何個のスライムの色を変える必要がある？

考察
同じスライムの色が2つ連続する→1回
同じスライムの色が3つ連続する→1回
同じスライムの色が4つ連続する→2回
そのため同じ色のスライムnつ連続に対してn//2回必要
これを列全体について数える
'''

N = int(input())
A = list(map(int,input().split(' ')))
ans = 0
chain = 1

for i in range(N):
	if i==0:
		continue
	elif A[i]==A[i-1]:
		chain += 1
	elif A[i]!=A[i-1]:
		ans += (chain//2)
		chain = 1
	if i==N-1:
		ans += (chain//2)
		chain = 1		
		
print(ans)

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]

counter = 0
i = 0

while i < N - 1:
    if(a[i] == a[i + 1]):
        counter += 1
        i += 1 
    i += 1

print(counter)

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]

counter=0
i=0
while i<N-1:
    if(i<N-2):
        if(a[i]==a[i+1]==a[i+2]):
            counter+=1
            i+=1
        elif(a[i]==a[i+1]):
            counter+=1
        i+=1
    else:
        if(a[i]==a[i+1]):
            counter+=1
        i+=1

print(counter)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(1,n):
    if a[i]==a[i-1]:
        ans += 1
        a[i] = 'x'
print(ans)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(1,n-2):
    if a[i-1] == a[i]:
        a[i] = -i
        ans += 1
    elif a[i+1] == a[i]:
        a[i+1] = - (i+1)
        ans += 1
if a[-1] == a[-2]:
	ans += 1
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a = [0] + a
for i in range(n):
    if a[i+1] == a[i]:
        a[i+1] = -1
print(a.count(-1))

Solution (Python):
N = int(input())
alist = list(map(int,input().split()))

counter = 0
for i in range(1,N):
    if alist[i-1]==alist[i]:
        counter += 1
        alist[i] += 10000

print(counter)

Solution (Python):
import sys
input = sys.stdin.readline

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

res = 0
used = [True]*n
for i in range(1,n):
    if a[i] == a[i-1] and used[i-1]:
        res += 1
        used[i] = False
print(res)

Solution (Python):
from itertools import groupby

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

ans = 0
for k, v in groupby(A):
  x = len(list(v))
  ans += x//2
print(ans)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

ans = 0
p = -1
cnt = 0
for i in range(N):
    if p == a[i]:
        cnt += 1
    else:
        ans += cnt // 2
        cnt = 1
        p = a[i]
ans += cnt // 2

print(ans)

Solution (Python):
n=int(input())
a=[int(i) for i in input().split()]

t=0
ans=0
for i in a:
    if i==t:
        ans+=1
        t=0
    else:
        t=i

print(ans)

Solution (Python):
N = int(input())
A = list(map( int, input().split()) )
from collections import defaultdict
d = defaultdict(int)

lst = []
i = 0
while i <= N-2:
  a = A[i]
  cnt = 1
  for j in range(i+1, N):
    if a == A[j]:
      cnt += 1
    else:
      break
  lst.append(cnt)
  
  i = j
  




ans = 0
def kf(x):
  if x  == 1:
    return 0
  elif x == 0:
    return 0
  elif x % 2 == 1:
    return x//2
  elif x % 2 == 0:
    return x//2
for k in lst:
  ans += kf( k )
print(ans)

Solution (Python):
N=int(input())
lst=[int(i) for i in input().split()]
lst.append(10e4)
def ans(A):
  return A//2
a=1
A=0
for i in range(N):
  if lst[i]==lst[i+1]:
    a+=1
  else:
    A+=ans(a)
    a=1
print(A)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(N-1):
    if a[i]==a[i+1]:
        a[i+1]=10**4+i+1
        ans+=1
print(ans)

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]
c = 1
ans = 0
for i in range(n-1):
  if a[i] == a[i+1]:
    c += 1
  else:
    ans += c // 2
    c = 1
ans += c // 2
print(ans)

Solution (Python):
n = int(input())
A = list(map(int,input().split()))

count = 0
for i in range(1,n):
    if A[i-1]==A[i]:
        count += 1
        A[i] = 0

print(count)

Solution (Python):
n = int(input())
ans = 0
a = list(int(i) for i in input().split())
for i in range(n-1):
  if a[i] == a[i+1]:
    a[i+1] = 100000
    ans += 1
print(ans)