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 i==0 or i==n or a[i-1] != a[i]:
    if i!=0:
      ans += cnt // 2
    cnt = 1
  else:
    cnt += 1
print(ans)

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

temp = 0
counter = 0
for a in As:
    if a == temp:
        counter += 1
        temp = 0
        continue
    temp = a
print(counter)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

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 I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = LI()
    c = -1
    r = 0
    for b in a:
        if b == c:
            c = -1
            r += 1
        else:
            c = b
    return r


print(main())

Solution (Python):
n = int(input())
d = input().split(" ")

ans = 0
count = 1

for i in range(n-1):
	if(d[i] != d[i+1]):
		ans += int(count/2);
		count = 1;

	else:
		count += 1

if(count > 1):
	ans += int(count/2)

print(ans)

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

d = input().split(" ")
ans = 0

for i in range(1,n-1):
	if(d[i] == d[i-1] and d[i] == d[i+1]):
		ans += 1
		d[i] = -i;

	elif(d[i] == d[i-1]):
		ans += 1
		d[i-1] = -i

	elif(d[i] == d[i+1]):
		ans += 1
		d[i+1] = -i

if(n == 2):
	if(d[0] == d[1]):
		ans += 1

print(ans)

Solution (Python):

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

ans = 0
for i in range(1, len(a)):
    if a[i] == a[i - 1]:
        ans += 1
        a[i] = 1000000

print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
slime = 101
count = 1
ans = 0

for i, s in enumerate(a):
    if s == slime:
        
        count += 1
    else:
        ans += count // 2
        count = 1
    slime = s
    if i == n - 1:
        ans += count // 2

print(ans)

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

print(ans)

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

count = 0
flgs = [0]*n

for i in range(n-1):
  if flgs[i] == 0 and nums[i] == nums[i+1]:
    count += 1
    flgs[i+1] = 1
print(count)

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

m=0
for i in range(1,len(a)):
    if a[i-1]==a[i]:
        a[i]=10000+i
        m+=1

print(m)

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

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

count=1
result=0
for i in range(len(a)-1):
    if a[i+1]==a[i]:
        count+=1
    else:
        result+=int(count/2)
        count=1
result+=int(count/2)
print(result)

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

i=1
count=0

while i<n:
  if a[i]==a[i-1]:
    count+=1
    i+=2
  else:
    i+=1

print(count)

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

Solution (Python):
n=int(input());a=list(map(int,input().split()));i=l=0
while True:
  if i>n-1:break
  j=i
  while j<n-1 and a[j+1]==a[j]:j+=1
  l+=(j-i+1)//2;i=j+1
print(l)

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

Solution (Python):
def getinputdata():

    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

            else:

                flg = 0
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])

arr=[int(arr_data[1][x]) for x in range(n)]

cnt=0
for i in range(0,n-1):
    
    if arr[i]==arr[i+1]:
        
        arr[i+1]=0
        cnt+=1
        
print(cnt)

Solution (Python):
import collections
import random

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

count = 0
for i in range(1, len(a)):
    if a[i] == a[i-1]:
        count += 1
        random.seed(i)
        a[i] = random.randrange(0, 1)
print(count)

Solution (Python):
N = input()

v = map(int, raw_input().split(' '))

found = 0

i = 0
while i < N:
	j = i
	while j < N - 1 and v[i] == v[j + 1]:
		j += 1

	found += (j - i + 1) / 2

	i = j + 1

print found

Solution (Python):


n=int(raw_input())
a=map(int,raw_input().split())
a.append(0)
cnt=0
temp=1
for i in xrange(1,n+1):
 if a[i]==a[i-1]:
  temp+=1
 else:
  cnt+=temp/2
  temp=1
print cnt

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]
l = [{a[0]:1}]
ans = 0
for i in a[1:]:
    k = l[-1]
    if k.get(i):
        k[i] += 1
        a[-1] = k
    else:
        k = {i:1}
        l.append(k)
for d in l:
    for i in d.values():
        ans += i // 2
print(ans)

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

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

Solution (Python):

SLIME_NUMBER = int(input())
SLIMES = tuple([int(s) for s in input().split()])

magic = 0

def is_repetitive(index):
    if index == SLIME_NUMBER - 1:
        return False
    return SLIMES[index] == SLIMES[index + 1]

index = 0
while index < SLIME_NUMBER - 1:
    if not is_repetitive(index):
        index += 1
        continue
    magic += 1
    additional_index = 1
    while is_repetitive(index + additional_index):
        if additional_index % 2 == 0:
            magic += 1
        additional_index += 1
    index += additional_index + 1
print(magic)

Solution (Python):
from collections import Counter

N = int(input())

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

back = -1
same = 1
ans = 0
for a in A:
    if a==back:
        same+=1
    else:
        ans += same//2
        same=1
    back = a
    
ans += same//2
    
print(ans)

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

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

print(count)

Solution (Python):
import sys

n = int(sys.stdin.readline())
a = list(map(int, sys.stdin.readline().split()))
i, c = 1, 0
while i < n:
    if a[i] == a[i-1]:
        c += 1
        i += 2
    else:
        i += 1
print(c)

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

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

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

a = a.split(" ")

ans = 0

for i in range(1, len(a)):
    if a[i-1] == a[i]:
        a[i] = "a"
        ans += 1

print(ans)

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

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

l = []

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

ans = 0

for x in l:
    if x != 1:
        ans += x // 2

print(ans)

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

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

Solution (Python):
N = int(input())
A = list(map(int, input().split())) + [None]
cnt = 0
ret = 0
for i in range(N):
    cnt += 1
    if A[i] != A[i + 1]:
        ret += cnt // 2
        cnt = 0

print(ret)

Solution (Python):
input()
slimeList = list(map(int, input().split()))
result = 0
count = 1
tmpSlime = slimeList[0]
for nextSlime in slimeList[1:]:
  if tmpSlime == nextSlime:
    count += 1
  else:
    result += count // 2
    count = 1
    tmpSlime = nextSlime
result += count // 2
print(result)

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]:
        A[i]=100000000
        count+=1
    else:
        pass
print(count)

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

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

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

    print(count)


if __name__ == '__main__':
    main()

Solution (Python):



if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    magic_count = 0
    previous_slime = a[0]

    
    
    for i in range(1, n):
        if a[i] == previous_slime:
            magic_count += 1
            previous_slime = -1
        else:
            previous_slime = a[i]

    print(magic_count)

Solution (Python):



if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    magic_count = 0
    slime_count = 1
    previous_slime = a[0]

    for i in range(1, n):
        if a[i] == previous_slime:
            slime_count += 1
        else:
            magic_count += slime_count // 2
            slime_count = 1

        previous_slime = a[i]

    print(magic_count + slime_count // 2)

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

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

Solution (Python):
n=int(input())
a=list(input().split())
a.append('E')
t='S'
c=0
s=0

for i in a:
  c+=1
  if i !=t:
    t=i
    s+=c//2
    c=0
print(s)

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

slime = list(map(int, input().split()))
ans = 0 
flag = 0
for s,t in zip (slime[:-1],slime[1:]):
  if flag == 1:
    flag = 0
  else:
    if s == t:
      ans += 1
      flag = 1
      
print(ans)

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

ans = []

i = 1
adjacent = 1

while i < n:
  if a[i] == a[i - 1]:
    adjacent += 1
  else:
    ans.append(adjacent // 2)
    adjacent = 1
  i += 1
  
ans.append(adjacent // 2)
print(sum(ans))

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

Solution (Python):
n = int(raw_input())
s = map(int, raw_input().split())
ct = 0
i = 1
while i < n:
    if s[i] == s[i-1]:
        ct += 1
        i += 2
    else:
        i += 1
print ct

Solution (Python):
input()
z = x = 0
for i in raw_input().split():
	if i == x:
		z += 1
		x = 0
	else:
		x = i
print z

Solution (Python):
N=int(input())
s=list(input().split())
count=0
while len(s)>1:
    a=0
    if s[0]!=s[1]:
        s.pop(0)
    else:
        while len(s)>=2 and s[0]==s[1]:
            a+=1
            s.pop(0)
        else:
            count+=(a+1)//2
print(count)

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

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

now=a[0]
c=1

ans=0

for i in range(1, n):
    if now==a[i]:
      c+=1
    else:
      now=a[i]
      ans+=c//2
      c=1
else:
    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]==a[i-1]:
        count += 1
        a[i]=0

print(count)

Solution (Python):
def main():
    """
    2 <= N <= 100
    1 <= ai <= N

    色の種類は10^4存在するが、N<=100より色は気にしなくて良い
    もし2色なら奥の色を考慮する必要がある

    abab: 0
    aaab: 1 (abab)
    aabb: 2 (acbc)
    aaaa: 2 (acac)
        2つ目のaを変更したあと、2と3つ目の関係を気にする必要がないので4つ目を考える
        4つ目を考慮することで3/5との関係を考慮できる
    """
    N = int(input())
    *A, = map(int, input().split())

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


if __name__ == '__main__':
    main()

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

answer = 0
t = 0
cursor = 0
while cursor != N:
    
    if t == a[cursor]:
        answer += 1
        t = 0
    else:
        t = a[cursor]
    cursor += 1
    

print(answer)

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

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

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

random.seed(42)
count = 0
for i in range(0, N-1):
    if a[i] == a[i+1]:
        count += 1
    while a[i] == a[i+1]:
        a[i+1] = random.randint(1, N)
        if i < N - 2:
            while a[i+1] == a[i+2]:
                a[i+1] = random.randint(1, N)

print(count)

Solution (Python):
N = int(input())
a = [s for s in map(int, input().split())]
a.append(-1)
c = 0
result = 0
for i in range(1, N + 1):
	if a[i] == a[i - 1]:
		c += 1
	else:
		if c == 0:
			continue
		else:
			c += 1
			if c % 2 == 1:
				result += (c - 1) / 2
				c = 0
			else:
				result += c / 2
				c = 0
print(int(result))

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

ans = 0
for i in range(1, n):
    if slimes[i] == slimes[i-1]:
        ans += 1
        slimes[i] = 999

print(ans)

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

counter = 0
for i in range(N-1):
    a1 = A[i]
    a2 = A[i+1]
    if a1 == a2:
        counter += 1
        A[i+1] = float('inf')

print(counter)

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

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


ans = []
i = 0
cnt = 0
while True:
    if i == n-1:
        cnt += 1
        ans.append(cnt)
        break
    if colors[i] != colors[i+1]:
        cnt += 1
        ans.append(cnt)
        cnt = 0
    else:
        cnt += 1
    i += 1


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

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

result = 0
mode = 0
for i in range(1, n):
	if a[i] == a[i - 1]:
		if mode == 0:
			result += 1
			mode = 1
		else:
			mode = 0
	else:
		mode = 0

print(result)

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

Solution (Python):


def getInput():
    N = int(input())
    in_row = [ int(x) for x in input().split(" ") ]
    return N, in_row

def checkNext(tail):
    cnt = 1
    for val in tail[1:]:
        if tail[0] == val:
            cnt += 1
        else:
            break
    return cnt

def countMagic(in_row):
    m_sum = 0
    i = 0
    while len(in_row) >= i-1:
        tmp = checkNext(in_row[i:])
        i += tmp
        m_sum += tmp // 2
    
    return m_sum

if __name__ == "__main__":
    N, in_row = getInput()
    print(countMagic(in_row))

Solution (Python):
N = int(input())
l = list(map(int,input().split(" ")))
num_n =[]
i=1
for j in range(N-1):
    if l[j] == l[j+1]:
        i+=1
    else:
        num_n.append(int(i/2))
        i=1
num_n.append(int((i+0.1)/2))
print(sum(num_n))

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

c = 0
'''
i = 0

while i+2 < len(l):
    if l[i] == l[i+1]:
        if l[i+1] == l[i+2]:
            print(i)
            c += 1
            i += 2
        else:
            print(i)
            c += 1
            i += 2
    else:
        if l[i+1] == l[i+2]:
            print(i)
            c += 1
            i += 2
'''

boon = False

for i in range(1,n):
    if not boon and l[i] == l[i-1]:
        c += 1
        boon = True
    else:
        boon = False

print(c)

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

c = 0

i = 0
while i+1 < n:
    if l[i] == l[i+1]:
        c += 1
        i += 2
    else:
        i += 1
print(c)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.append(-1)
p = -1
c = 1
ans = 0
for n in a:
    if n == p:
        c += 1
    else:
        ans += c // 2
        c = 1
    p = n
print(ans)

Solution (Python):
def main():
    N = int(input())
    slimes = list(map(int, input().split()))
    ans = 0

    for i in range(1, N):
        if slimes[i-1] == slimes[i]:
            slimes[i] = 10001 + ans
            
            
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import random

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

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

Solution (Python):
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
n=i1()
a=i2()
c=0
for i in range(n-1):
 if a[i]==a[i+1]:
   a[i+1]=-1
   c+=1
print(c)

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

Solution (Python):

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

Solution (Python):
import random

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

ch = A[0]
cnt = 1
R = 0
for i in range(1, N):
    
    if ch != A[i]:
        R += cnt // 2
        cnt = 1
        ch = A[i]
    else:
        cnt += 1

R += cnt // 2

print(R)

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] = 10000
print(ans)

Solution (Python):
from sys import stdin
data = [stdin.readline().rstrip().split() for _ in range(2)]
count = 0
i = 0
while i + count+ 1 < int(data[0][0]):
    if (data[1][i + count+ 1] == data[1][i + count]):
        count = count + 1
    i = i + 1
print(count)

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

p = None
chain = 0
cnt = 0

for a in map(int,input().split()):
  if a == p:
    chain += 1
  else:
    cnt += chain//2
    p = a
    chain = 1

cnt += chain//2

print(cnt)

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

before_a = 0
magic_number = 0
for a_i in a:
  if before_a == a_i:
    magic_number += 1
    before_a = 0
  else:
    before_a = a_i
print magic_number

Solution (Python):
 

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


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

Solution (Python):



N = int(input())
A = [int(i) for i in input().split()] + [0]

count = 0
tmp = 1
for i in range(1, N+1):
    if A[i] == A[i - 1]:
        tmp += 1
    else:
        
        count += tmp // 2
        tmp = 1  

print(count)

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

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

print(count)

Solution (Python):
N = int(input())
A = input().split() + [0]

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

print(ans)

Solution (Python):
n = input()
slimes = map(int, input().split())
res = 0
last = -1
cnt = 0
for slime in slimes:
    if slime != last:
        res += cnt // 2
        last = slime
        cnt = 1
    else:
        cnt += 1

res += cnt // 2

print(res)

Solution (Python):
input()
ans=x=0
for a in input().split():
    ans+=a==x
    x=a*(a!=x)
print(ans)

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

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

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

result = 0

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

print(result)

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
cnt = 0
i = 1
while True:
    if i >= N:
        break
    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()))

res = 0
cnt = 1

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

print(res)

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

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

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

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

p = a[0]
cont_cnt = 1
to_chg = 0

for i in range(1, N) :
    if p == a[i] :
        cont_cnt += 1
        p = a[i]
    else :
        if cont_cnt >= 2 :
            to_chg += cont_cnt // 2
            p = a[i]
            cont_cnt = 1
        else :
            p = a[i]

if cont_cnt >= 2 :
    to_chg += cont_cnt // 2
    p = a[i]
    cont_cnt = 1

print(to_chg)

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

change = 0
i = 1
length = 1
while i < n:
    if col[i] == col[i-1]:
        length += 1
    else:
        change += length // 2
        length = 1
    i += 1
else:
    change += length // 2

print(change)

Solution (Python):
def main():
    N = int(input())
    ss = list(map(int, input().split()))

    if N <= 1:
        print(0)
        return
    a = ss.pop(0)
    count = 0
    for b in ss:
        if a == b:
            count += 1
            a = -1
        else:
            a = b
    print(count)

if __name__ == '__main__':
    main()

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

i = 0
magic = 0
while(i < n):
	length = 1
	while(a[i] == a[i+1]):
		length += 1
		i += 1
		if(i == n-1):
			break
	magic += int(length / 2)
	i += 1
	if(i == n-1):
		break
print(magic)

Solution (Python):
input()
n=-1
res = 0
for i in input().split():
    if i == n:
        res+=1
        n=-1
    else:
        n = i
print (res)

Solution (Python):
from sys import stdin


def get(l, r):
    for i in range(1, 10001):
        if i != l and i != r:
            return i
    assert False, 'damepo'


def main():
    N = int(stdin.readline().rstrip())
    a = [int(x) for x in stdin.readline().rstrip().split()]

    count = 0
    if N == 2:
        if a[0] == a[1]:
            count += 1
    else:
        for i, x in enumerate(a[1:-1]):
            idx = i + 1
            l = a[idx - 1]
            r = a[idx + 1]
            if (l == x and x != r) or (l == x == r) or ((idx == len(a) - 2) and x == r):
                x = get(l, r)
                count += 1
                a[idx] = x
        
    print(count)


if __name__ == '__main__':
    main()

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

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

li_int = [int(i) for i in range(1, 10001)]

li_use = set(li_int) - set(a)
li_use = list(li_use)

ans = 0

for j in range(len(a)-1):
    if a[j] == a[j+1]:
        a[j+1] = li_use[j]
        ans += 1
        li_use.remove(li_use[j])
else:
    print(ans)

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

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

Solution (Python):
n=input()
a=map(int,raw_input().split())
ans=0
eq=0
for i in xrange(n):
	if i!=0 and a[i]!=a[i-1]:
		eq=0
	eq+=1
	if eq%2==0:
		ans+=1
print ans

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


mag = 0
con = 1
for i in range(1, n):
    
    if A[i-1] == A[i]:
        con += 1
    else:
        mag += con // 2
        con = 1
mag += con // 2
print(mag)

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

print(ans)

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

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

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


count = 0

i = 0

while i < N - 1:
    j = 1
    while A[i + j] == A[i]:
        j += 1
        if i + j > N-1:
            break

    count += int(j / 2)
    i = i + j

print(count)

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

pre = -1
num = 1
ans = 0
for i in a:
	if pre == i:
		num += 1
	else:
		ans += num // 2
		num = 1
	pre = i
ans += num // 2
print(ans)

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

change_cnt_fron_right = 0
change_cnt_fron_left = 0

for i in range(n-1):
    if a_list[i] == a_list[i+1]:
        change_cnt_fron_right += 1
        a_list[i + 1] = 0
        

print(change_cnt_fron_right)

Solution (Python):

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

a.append(999)
magic = 0
series = 1
prev=0
for x in a:

    if prev>0:
        if prev==x:
            series+=1

        else:
            magic+=int(series/2)
            series=1

    prev=x
print(magic)

Solution (Python):
import random
N = int(input())
cnt = 0
slime = list(map(int,input().split()))
for i in range(N):
  try:
    if slime[i]==slime[i+1]:
      cnt+=1
      while slime[i]==slime[i+1]:
        slime[i+1]=random.randint(1,10000)
  except IndexError:
    break;

print(cnt)

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

if N != 2:
    for i in range(1,N-1):
        if a[i] == a[i-1]:
            a[i] = a[i+1] + 1
            count = count + 1
else:
    if a[0] == a[1]:
        a[0] = a[1]+1
        count = count + 1

if a[N-2] == a[N-1]:
    count = count + 1

print(count)

Solution (Python):
n = int(input())
l = input().split()
prev = 0
flag = False
result = 0
for i in l:
    if flag == False and i == prev:
        flag = True
        result += 1
    elif flag == True:
        flag = False
    prev = i
print(result)

Solution (Python):
from sys import stdin
n = int(stdin.readline())
a = map(int,stdin.readline().split())
ans = 0
pr = 0
cnt = 0
for i in a:
 if i==pr:
  cnt+=1
 else:
  ans += cnt/2
  cnt = 1
 pr = i
ans += cnt/2
print ans

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

a = [int(i) for i in input().split()]
b = -1
count = 0
ans = 0
for a_ in a:
    if b == a_:
        count += 1
    else:
        ans += count //2
        count = 1
    b = a_

ans += count //2
print(ans)

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

Solution (Python):


num = int(raw_input())
num_li = list(map(int,raw_input().split()))
li = []
t  = -1
answer = 0
for i in range (num):
    if t != num_li[i]:
        li.append(1)
        t = num_li[i]
    else:
        li[-1] += 1
        t = num_li[i]
for i in li:
    answer += i//2
print answer

Solution (Python):


def solve():
    N = int(input())
    arr = list(map(int, input().split()))
    arr.append(0)

    i = 0
    magic_cnt = 0
    while i < N:
        adj_cnt = 1
        while i < N and arr[i] == arr[i + 1]:
            i += 1
            adj_cnt += 1
        magic_cnt += int(adj_cnt / 2)
        i += 1
    print(magic_cnt)


if __name__ == '__main__':
    solve()