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()))
ans=0
for i in range(n-1):
    if a[i]==a[i+1]:
        a[i+1]=0
        ans+=1
print(ans)

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

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

Solution (Python):
n=int(input())
from itertools import groupby as gb
ans=0
for a,b in gb(list(map(int,input().split()))):
    ans+=len(list(b)) //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]:
        ans+=1
        a[i+1]=0
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] = 0
    ans += 1
print(ans)

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

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

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

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

r = 0
c = 1
h = a[0]
for i in range(1, n):
    if h == a[i]:
        c += 1
        if c%2==0:
            r += 1
    else:
        c = 1
        h = a[i]
print(r)

Solution (Python):
N=int(input())
A=[int(i) for i in input().split()]
prev=-1
ans=0
cnt=1
for a in A:
    if prev==a:
        cnt+=1
    else:
        ans+=cnt//2
        cnt=1
    prev=a
ans+=cnt//2
print(ans)

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

pre = 0
answer = 0
for a in A:
    if pre == a:
        answer += 1
        pre = 101
    else:
        pre = a
    
print(answer)

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

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

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

print(ans)

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

Solution (Python):
N = int(input())

def kansuu(list_x):
    result = []
    cnt = 1
    for i in range(len(list_x)-1):
        if list_x[i] == list_x[i+1]:
            cnt += 1
        else:
            num = list_x[i]
            result.append((num,cnt))
            cnt = 1
    result.append((list_x[-1],cnt))
    return result

a_li = list(map(int,input().split()))
ans = 0
for _,i in kansuu(a_li):
    if i == 1:
        continue
    else:
        ans += i//2
print(ans)

Solution (Python):
from statistics import median


from fractions import gcd
from itertools import combinations 
from collections import deque
from collections import defaultdict
import bisect










import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    A = readInts()
    ans = 0
    
    for i in range(1,n):
        if A[i] == A[i-1]:
            ans += 1
            A[i] = -1
    print(ans)
if __name__ == '__main__':
  main()

Solution (Python):
import sys
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]

N = ri()
a = ri_()
ans = 0
cnt = 0
now = 10000
for i in range(N):
    if a[i] == now:
        cnt += 1
    else:
        ans += -(-cnt//2)
        cnt = 0
        now = a[i]  
ans += -(-cnt//2)
print(ans)

Solution (Python):

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

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

print(a.count(0))

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

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

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

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

Solution (Python):
def agc026_a():
  n = int(input())
  A = list(map(int, input().split()))
  
  B = []
  num = A[0]
  count = 1
  for i in range(1, n):
    if A[i] == num:
      count += 1
    else:
      B.append(count)
      num = A[i]
      count = 1
  else:
    B.append(count)
  ans = 0
  for b in B:
    ans += b // 2
  print(ans)

agc026_a()

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


N = int(input())
a = list(input().split())
prev = a[0]

for i in range(1, N):
	if a[i] == prev:
		a[i] = 'changed'
	
	prev = a[i]

print(a.count('changed'))

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    

    
    

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

if __name__ == '__main__':
    main()

Solution (Python):
from itertools import*;input();print(sum(len(list(j))//2for _,j in groupby(input().split())))

Solution (Python):
from itertools import*
input()
print(sum(len(list(j))//2for _,j in groupby(input().split())))

Solution (Python):
from itertools import*
print(sum(len(list(j))//2 for _, j in groupby(open(0).read().split()[1:])))

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

c=itertools.groupby(a)

ans=0
for i,gr in c:
    ans+=len(list(gr))//2
print(ans)

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

ans = 0
pre = 0
for a in A:
  if pre == a:
    pre = 0
    ans += 1
  else:
    pre = a

print(ans)

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

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

ans += -(-cnt//2)
cnt = 0

print(ans)

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

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

Solution (Python):
import sys  
import numpy as np

input = sys.stdin.readline
A = int(input())
a = list(map(int, input().split()))
sum1 = 0
for i in range(1,A):
    if a[i-1] == a[i]:
        sum1+=1
        a[i] = 0

print(sum1)

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

s=0
for i in range(len(a)-1):
    if(a[i]==a[i+1]):
        a[i+1]=str(a[i])
        s+=1
print(s)

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

s=0
for i in range(len(a)-1):
    if(a[i]==a[i+1]):
        a[i+1]=str(a[i])
        s+=1
print(s)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, *a = map(int, read().split())
cnt = 0
for i in range(1, n):
    if a[i] == a[i - 1]:
        a[i] = 0
        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]=-1
        ans+=1
print(ans)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
ans = 0
flag = 0
for i in range(1,N):
  if a[i - 1] == a[i] and flag == 0: 
    ans += 1
    flag = 1
  else: flag = 0  
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] = "*"

print(ans)

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A += [100000]

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

print(cnt)

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()

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

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

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
t=c=0
s=0
for i in a:
    if i==t:
        c+=1
    else:
        t=i
        s+=c//2
        c=1
print(s+c//2)

Solution (Python):

def inputlist(): return [int(j) for j in input().split()]

N = int(input())
a = input().split()
li = []
s = 1
for i in range(1,N):
    if a[i] != a[i-1]:
        li.append(s)
        s = 1
        continue
    if a[i] == a[i-1]:
        s +=1
if s != '':
    li.append(s)
n = len(li)
ans = 0
for i in range(n):
    l = li[i]
    ans += l//2
print(ans)

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

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

l = [1]
for i in range(1, n):
    if (a[i] == a[i - 1]):
        l[len(l) - 1] += 1
    else:
        l.append(1)

ans = 0
for ln in l:
    ans += ln // 2

print(ans)

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
A = iil()
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]=0
    cnt +=1
    
print(cnt)

Solution (Python):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') 
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(sys.stdin.readline()) 
def ifn(): return float(sys.stdin.readline()) 
def isn(): return sys.stdin.readline().split() 
def imn(): return map(int, sys.stdin.readline().split()) 
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) 
def fmn(): return map(float, sys.stdin.readline().split()) 
def iln(): return list(map(int, sys.stdin.readline().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def fln(): return list(map(float, sys.stdin.readline().split())) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()
a = iln()

count = 0
for i in range(1, N):
    if a[i-1] == a[i]:
        a[i] = 1000
        count += 1
print(count)

Solution (Python):
n = int(input())
A = list(map(int,input().split()))
pre_col = A[0]
flg = False
res = 0
for i in range(1, n):
    if flg or A[i] != pre_col:
        pre_col = A[i]
        flg = False
    elif A[i] == pre_col:
        res += 1
        flg = True
print(res)

Solution (Python):
N = int(input())
arr = list(map(int, input().split()))
ans = 0
flg = False
for i in range(1,N):
    if flg:
        flg = False
        continue
    if arr[i] == arr[i-1]:
        ans += 1
        flg = True
    else:
        flg = False
print(ans)

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

Solution (Python):
N=int(input())
L=list(map(int,input().split()))
count=0
i=0
while(1):
	if i>=N-1:
		break
	elif L[i]==L[i+1]:
		count+=1
		i+=2
	else:
		i+=1
print(count)

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

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

dummy = -9999
prev = dummy
ct = 0
for i in l:
    if i == prev:
        ct += 1
        prev = dummy
    else:
        prev = i
        
print(ct)

Solution (Python):




def main():
    n = int(input())
    slimes = list(map(int,input().split()))
    length = length_of_sequences(slimes)
    total = 0
    for l in length:
        total += l//2
    print(total)

def length_of_sequences(l):
    length = []
    counter = 1
    for i,slime in enumerate(l):

        if i == 0:
            continue
        if l[i-1] == l[i]:
            counter += 1
        else:
            length.append(counter)
            counter = 1
        if i == len(l)-1:
            length.append(counter)

    return length



if __name__ == '__main__':
    main()

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

pre=A[0]
ans=0

for i in range(1,len(A)):
    if pre==A[i]:
        ans+=1
        pre=101
    
    else:
        pre=A[i]
print(ans)

Solution (Python):

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

ans = 0
count = [0 for _ in range(n)]
j = 0
for i in range(n - 1):
    if a[i] == a[i + 1]:
        count[j] += 1
    if a[i] != a[i + 1]:
        count[j] += 1
        j += 1
count[j] += 1


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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
now = A[0]
ans = 0
for i in range(1, N):
    if now == A[i]:
        ans += 1
        for j in range(1, N + 1):
            if i == N - 1:
                if j != A[i - 1]:
                    A[i] = j
                    break
            else:
                if j != A[i - 1] and j != A[i + 1]:
                    A[i] = j
                    break
    now = A[i]
print(ans)

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

cnt=0
temp=1
pre_str=a[0]
for i in range(1,n):
    if a[i]==pre_str:
        temp+=1
    else:
        pre_str=a[i]
        temp=1

    if temp%2==0:
        cnt+=1
print(cnt)

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

Solution (Python):
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    count = 0
    for i in range(1, N):
        if A[i] == A[i-1]:
            count += 1
            A[i] = -1
    print(count)


    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
l=[]
t=0

for i in range(n-1):
    if i==n-2:
        if a[i+1]==a[i]:
            t+=2
            l.append(t)
        else:
            t+=1
            l.append(t)
            l.append(1)
        continue      
    if a[i+1]==a[i]:
        t+=1
    else:
        t+=1
        l.append(t)
        t=0

ans=0
for ll in l:
    ans+=ll//2
print(ans)

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

Solution (Python):



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


magic_num = 0
chohuku_num = 0


for i in range(0, N):
    if i==0:
        continue

    if a_list[i]==a_list[i-1]:
        chohuku_num += 1
    else:
        magic_num += (chohuku_num + 1) // 2
        chohuku_num = 0
magic_num += (chohuku_num + 1) // 2

print(magic_num)

Solution (Python):
if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

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

    print(ans)

Solution (Python):
n = int(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)

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

res = 0
for i in range(1, n):
    if a[i] == a[i - 1]:
        a[i] = 101
        res += 1

print(res)

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

x = 0
ans = 0
for i in A:
    if i == x:
        ans += 1
        x = 0
        continue
        
    x = i
    
print(ans)

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

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

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

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

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

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

Solution (Python):
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = 0
    pre = A[0]
    changed = False
    for a in A[1:]:
        if changed:
            changed = False
        elif pre == a:
            ans += 1
            changed = True
        pre = a
    print(ans)


if __name__ == '__main__':
    main()

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

Solution (Python):
n=int(input())
a = [int(i) for i in input().split()]
ans = 0
b = 0
j = -1
for i in a:
    if i != j:
        ans += b // 2
        b=1
    else:
        b += 1
    j = i
ans += b // 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] != -1 and A[i] == A[i + 1]:
        A[i + 1] = -1
        ans += 1

print(ans)

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

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

print(cnt)

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]:
    a[i]=-1
    ans+=1
print(ans)

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

Solution (Python):

import sys
from itertools import groupby

def solve(N: int, a: "List[int]"):
    group = groupby(a)
    answer = 0
    for key,value in group:
        answer += len(list(value))//2
    print(answer)

    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(' ')))

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

print(ret)

Solution (Python):
n = int(input())
li = [int(x) for x in input().split()]
a = 10**6
ans = 0
for i in range(n-1):
    if li[i]==li[i+1]:
        li[i+1] = a
        a += 1
        ans += 1
print(ans)

Solution (Python):
N = int(input())
A = [int(a) for a in 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):
def main():
    slimes = int(input())
    color = list(input().split()) + ["-1"]
    before = color[0]
    count = 1
    answer = 0
    for i in range(1, slimes + 1):
        if before == color[i]:
            count += 1
        else:
            before = color[i]
            answer += count // 2
            count = 1
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):

        
    
    
    
    
    
    

    
    
    



    


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

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

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

print(cnt)

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

Solution (Python):


n = int(input().rstrip())

numbers = list(map(int, input().rstrip().split(" ")))

start = 0
ans = 0
for i in range(1,n):
    if numbers[i] != numbers[i - 1]:
        tmp = i - start
        ans += int(tmp/2)
        start = i

ans += int((n-start)/2)

print(ans)

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

Solution (Python):



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


magic_num = 0
chohuku_num = 0


for i in range(0, N):
    if i==0:
        continue

    if a_list[i]==a_list[i-1]:
        chohuku_num += 1
    else:
        magic_num += (chohuku_num + 1) // 2
        chohuku_num = 0
magic_num += (chohuku_num + 1) // 2

print(magic_num)

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

i = 0
cnt = 0
while(i<N-1):
    if A[i]==A[i+1]:
        cnt += 1
        i += 1
    i+=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]:
        ans += 1
        a[i+1] = 500 + i



print(ans)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
count = 1
key = a[0]
ans = 0
if n==1:
    print(0)
else:
    for i in range(1,n):
        if key == a[i]:
            count += 1
        else:
            ans += count//2
            key = a[i]
            count = 1
ans += count//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] = a[i+1] + 10
        ans = ans + 1


print(ans)

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

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

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

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

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
a_list = list(map(int, input().split()))
before = 0
i = 0
for x in a_list:
    if x == before:
        i += 1
        before = None
        continue
    before = x

print(i)

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

cont = []
c = 1
for i in range(N-1):
    if A[i] == A[i+1]:
        c += 1
    else:
        cont.append(c)
        c = 1
else:
    cont.append(c)


ans = 0
for ci in cont:
    ans += ci // 2
print(ans)

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

ans = 0
be = A[0]
for ai in A[1:]:
    if be == ai:
        ans += 1
        be = -1
    else:
        be = ai

print(ans)

Solution (Python):
import math
N=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(N-1):
    if a[i]==a[i+1]:
        cnt=cnt+1
        a[i]=""
        a[i+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]:
        ans+=1
        if i==n-2:
            a[i+1]=(a[i])%10000+1
        else:
            a[i+1]=10001
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]:
    a[i] = 0
    ans += 1
print(ans)

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

ans = 0
before = A[0]
for i in range(1, n):
    if A[i] == before:
        ans += 1
        before = 0
    else:
        before = A[i]
print(ans)

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

prev = -1
answer = 0
for a in li_a:
    if prev == a:
        answer += 1
        prev = -1
    else:
        prev = a
print(answer)

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

Solution (Python):
n = int(input())
dat = list(map(int, input().split()))
p = dat[0]
res = 0
for i in range(1, len(dat)):
    if p == dat[i]:
        dat[i] = "x"
        p = "x"
        res += 1
    else:
        p = dat[i]
print(res)

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

Solution (Python):
from itertools import groupby

def main():
    N = int(input())
    a = list(map(int,input().split()))
    gp = []
    for key,value in groupby(a):
        gp.append(list(value))
    ans = 0
    for i in range(len(gp)):
        ans += len(gp[i])//2
    print(ans)

if __name__ == '__main__':
    main()

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