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())
arr = list(map(int,input().split()))
cur = 0
seq=1
ans=0
for i in range(n):
    if cur==arr[i]:
        seq+=1
    else:
        cur=arr[i]
        ans+=seq//2  
        seq=1
else:
    ans+=seq//2
print(ans)

Solution (Python):
import numpy as np
from copy import deepcopy

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

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

res = 0
cnt = 1
prev = A[0]
for idx in range(1, N):
    if A[idx] == prev:
        cnt += 1
    else:
        cnt = 1
    if cnt > 1:
        cnt = 0
        res += 1
    prev = A[idx]

print(res)

Solution (Python):
import sys
import socket

if socket.gethostname() in ['N551J', 'F551C']:
    sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


def solve():
    n = read_int()
    a = read_int_list()
    res = 0
    i = 0
    while i < n:
        j = i + 1
        while j < n and a[j - 1] == a[j]:
            j += 1
        l = j - i
        res += l // 2
        i = j
    return res


def main():
    res = solve()
    print(res)


if __name__ == '__main__':
    main()

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

def plus(n):
    if n == 1:
        return 0
    elif n <= 3:
        return 1
    else:
        return n // 2

tmp=1
for i in range(1,N):
    if a[i-1] == a[i]:
        tmp += 1
    else:
        res += plus(tmp)
        tmp = 1
res += plus(tmp)


print(res)

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

ans=0
prev=""

for x in A:
	if prev==x:
		ans+=1
		prev=-1
	else:
		prev=x

print ans

Solution (Python):
n = int(input())
list = list(map(int, input().strip().split()))
list.append(10001)
list.append(10002)
count = 0
i = 0
while i < n:
    if list[i] == list[i + 1] and list[i + 1] and list[i + 2]:
        count += 1
        i += 2
        continue
    elif list[i] == list[i + 1]:
        count += 1
    i += 1
print(count)

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

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

ans = 0
for i in range(len(sequence)):
    ans += (sequence[i] // 2)

print(ans)

Solution (Python):
from math import floor
N = int(input())
a = list(map(int,input().split()))
a.append(0)
s = 0
S = 0
ans = 0
for i in range(N+1):
    if a[i] != s:
        s = a[i]
        ans += floor((S+1)/2)
        S = 0
    else:
        S += 1
print(ans)

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

ans = 0
res = 1

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

print(ans)

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

result = 0
flag = False
for i in range(1,n):
  if flag == True:
    flag = False
    continue
  if a[i-1] == a[i]:
    result += 1
    flag = True

print(result)

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

Solution (Python):


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

cnt = 0
Q = [string[0]]
for i in range(1,n):
    if Q[0] == string[i]:
        Q.append(string[i])
    else:
        cnt += len(Q) //2
        Q = [string[i]]

cnt += len(Q) // 2

print(cnt)

Solution (Python):


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

cnt = 0
Q = [string[0]]
for i in range(1,n):
    if Q[0] == string[i]:
        Q.append(string[i])
    else:
        cnt += len(Q) //2
        Q = [string[i]]

cnt += len(Q) // 2

print(cnt)

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
        if i==n-1:
            ans+=c//2
    else:
        ans+=c//2
        c=1
print(ans)

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

Solution (Python):

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

i = 0
ans = 0

while i < N - 1:
    if A[i + 1] == A[i]:
        if i < N - 2:
            A[i + 1] == A[i] + A[i + 2]
        if i == N - 1:
            A[i + 1] += 1
        i += 1
        ans += 1
    i += 1

print(ans)

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

print(c)

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

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

print(ans)

Solution (Python):
_ = input()
aa = list(map(int, input().split()))

prev = aa[0]
cnt = 1
ops = 0
for a in aa[1:]:
    if a == prev:
        cnt += 1
    else:
        ops += cnt // 2
        cnt = 1
    prev = a

ops += cnt // 2

print(ops)

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

a=list(map(int,input().split()))
count=1
countlist=[]

for i in range(1,N):
  if a[i]==a[i-1]:
    count+=1
    if i==N-1:
      countlist.append(count)
  else:
    countlist.append(count)
    count=1

if countlist==[]:
  print(0)
  exit()

answer=0
for i in range(len(countlist)):
  answer+=(countlist[i])//2
print(answer)

Solution (Python):

N = int(raw_input())
a = map(int,raw_input().split())

same_color_list = []
same=1

for i in range(N):
    if i != 0:
        if a[i] == a[i-1]:
            same+=1
        else:
            if same!=1:
                same_color_list.append(same)
                same=1
if same!=1:
    same_color_list.append(same)

count = 0
for same in same_color_list:
    count += same/2

print count

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

s = 0
for i in L:
	s += i // 2
print(s)

Solution (Python):
N = int(input())
A = [int(i) for i in 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):
N = int(input())
a = [int(i) for i in input().split()]

ans = 0

count = 1
pre_num = a[0]
for i in range(1, len(a)):
    if a[i] == pre_num:
        count += 1
    else:
        ans += count // 2
        count = 1
        pre_num = a[i]
ans += count // 2
print(ans)

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

ans = 0
for i in range(n-1):
    if a[i] == a[i+1]:
        ans += 1
        a[i+1] = (a[i+1] + 1) % 10000
        if i != (n-2) and a[i+1] == a[i+2]:
            a[i+1] = (a[i+1] + 1) % 10000

print(ans)

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

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

ans = 0
tmp = 0
before = 0
a_list.append(100000)

for a in a_list:

    if a == before:
        tmp += 1
    elif tmp > 0:

        ans += (tmp+1) // 2
        tmp = 0
    before = a
print(ans)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
stan = A[0]
ans = 0
k = 0
for i in range(1,N):
    if stan == A[i]:
        ans += 1 + k
        k = -((k-1)%2)
    else:
        k = 0
    stan = A[i]
print(ans)

Solution (Python):
n = int(input())
a = [int(i) for i in list(input().split())]
same_flag = False
cnt = 0
for i, color in enumerate(a):
    if i == 0:
        tmp = color
    else:
        if same_flag:
            cnt += 1
            same_flag = False
            tmp = color
        else:            
            if color == tmp:
                same_flag = True
                tmp = color
            else:
                tmp = color
if same_flag:
    cnt += 1
print(cnt)

Solution (Python):
input()
cnt=0
now=0
res=0
for a in map(int,input().split()):
    if a==now:
        cnt+=1
    else:
        res+=cnt//2
        cnt=1
    now=a
print(res+cnt//2)

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

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

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

cnt = 0

al = False
for i, a in enumerate(a_list):
    if i == 0:
        pre = a
    else:
        if a == pre:
            if not al:
                al = True
                cnt += 1
            else:
                al = False
        else:
            al = False
            
        pre = a
        
print(cnt)

Solution (Python):
def LI(): return list(map(int, input().split()))
n = int(input())
a = LI()
cnt = 0
tmp_cnt = 1
start = a[0]
for i in range(1, n):
    if a[i] != start:
        start = a[i]
        cnt += tmp_cnt//2
        tmp_cnt = 1
    else:
        tmp_cnt += 1
cnt += tmp_cnt // 2
print(cnt)

Solution (Python):




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

    idx, t = 0, 0
    while idx < n:
        cnt = 1
        while idx < n-1 and a[idx] == a[idx+1]:
            cnt += 1
            idx += 1
        t += cnt // 2
        idx += 1

    print(t)


if __name__ == '__main__':
    main()

Solution (Python):
from itertools import groupby

if __name__ == "__main__":
    n = int(input())
    xs = [int(s) for s in input().split()]
    ans = sum(length // 2 for length in [len(list(l)) for t, l in groupby(xs)])
    print(ans)

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

spell_cnt = 0
spelled = False
for i, color in enumerate(a[1:]):
    
    if a[i] == color and not spelled:
        
        spell_cnt += 1
        spelled = True
    else:
        spelled = False

print(spell_cnt)

Solution (Python):


n = int(input().strip())
an = map(int, input().strip().split(' '))

cnt = 0
b_a = None
for a in an:
    if a == b_a:
        cnt += 1
        b_a = None
    else:
        b_a = a

print(cnt)

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

counter = 0
cont = 1
prev = -1

for a in A:
    if a == prev:
        cont += 1
    else:
        counter += cont // 2
        cont = 1
    prev = a

counter += cont // 2

print(counter)

Solution (Python):
N = int(input())
a = [int(x) for x in input().split()]
result = 0
prev = a[0]
change = False
for i in range(1, N):
	if prev == a[i] and not change:
		result += 1
		change = True
	else:
		change = False
	prev = a[i]
print(result)

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

count = 0
ans = 0
last = 0
for a in A:
    if a != last:
        ans += count // 2
        count = 1
        last = a
    else:
        count += 1
ans += count // 2
print(ans)

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

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

print(ans)

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

print(cnt)

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

result = 0
count = 0
last = 0
for a in A:
    if a == last:
        count += 1
    else:
        result += count // 2
        count = 1
        last = a
else:
    result += count // 2
    
print(result)

Solution (Python):
n=int(input())
s=input().split()
l=[None]*n
for i in range(n):
    l[i]=int(s[i])
res=0
i=1
while True:
    if i>=n:
        break
    if l[i-1]==l[i]:
        res+=1
        i+=1
    i+=1
print(res)

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

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

print(ans)

Solution (Python):
N=int(input())
L=input()
L=L.rstrip().split(" ")
list1=[]
for i in range(N):
    list1.append(int(L[i]))

count=0
for j in range(1,N):
    if list1[j]==list1[j-1]:
        count+=1
        list1[j]=-1

print(count)

Solution (Python):
import numpy as np

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

a = np.array(a)

b = 1000

k = 0
for k in range(len(a)-1):
    temp = a[k]
    if a[k+1] == temp:
        a[k+1] = b
        b += 1


print(b - 1000)

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

ans = 0
idx = 1
while (idx < n):
    if a[idx] == a[idx-1]:
        ans += 1
        idx += 2
    else:
        idx += 1
print(ans)

Solution (Python):
N = int(input())
dif = []
a = list(map(int,input().split()))
bef = a[0]
for i,j in enumerate(a):
    if i==0:
        bef = j
        sum = 1
    elif j==bef:
        sum += 1
    else:
        dif.append(sum)
        sum = 1
        bef = j
dif.append(sum)

res = 0
for i in dif:
    res += i//2
print(res)

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

tmp = array[0]
cnt = []
cnt_tmp = 0
for i in array:
    if tmp == i:
        cnt_tmp += 1
    else:
        cnt.append(cnt_tmp)
        tmp = i
        cnt_tmp = 1

res = 0
for i in cnt:
    if i != 1:
        if i %2:
            res += i//2
        else:
            res += i//2
print(res)

Solution (Python):
N = int(input())
lis = [int(i) for i in input().split()]
i = 0
same = 1
ans = 0
while i < N-1:
  if lis[i] == lis[i+1]:
    same += 1
  else:
    ans += same//2
    same = 1
  i += 1
ans += same//2
print(ans)

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

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

print(ans)

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

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

for i in range(0,N-1):
    if L[i] == L[i+1]:
        L[i+1] = 101
        count += 1

print(count)

Solution (Python):
from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
write = stdout.write

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

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

main()

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
count = 0
conti = 0
last = None
for _ in A:
    if _ == last:
        conti += 1
        if conti % 2 == 1:
            count += 1
    else:
        conti = 0
    last = _
print(count)

Solution (Python):
N = int(input())
A = map(int, input().split())
magic = 0
seq = 1
pre_a = 0
for a in A:
  if a == pre_a:
    seq += 1
  else:
    magic += seq // 2
    seq = 1
  pre_a = a
magic += seq // 2
print(magic)

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] += 10000
        cnt += 1
print(cnt)

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

ans=0
ch=False
for i in range(1,N):
  if A[i]==A[i-1] and ch==False:
    ans+=1
    ch=True
  else:
    ch=False
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] = 1000000
print(ans)

Solution (Python):
def main():
    input()
    cc = map(int, raw_input().split())
    s = 0
    pre = -1
    cont = 0
    for c in cc:
        if c == pre:
            cont += 1
        else:
            s += cont / 2
            pre = c
            cont = 1
    s += cont / 2
    print s


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
gou = 0
j=1
for i in range(1,len(a)):
  i=j
  if j >= len(a):
    break
  if a[i-1] == a[i]:
    gou += 1
    j = i+2
  else:
    j = i+1
print(gou)

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

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

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

print(ans)

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

num=1
score=0
for i in range(1,N+1):
    if slime[i]==slime[i-1]:
        num+=1
    else:
        score+=num//2
        num=1

    

print(score)

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

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

Solution (Python):


n = int(input())

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

res = 0

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

print(res)

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

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


prev = 10001
count = 0

for i in range(N):
  if prev == li[i]:
    count += 1
    prev = 10001
  else:
    prev = li[i]
    
print(count)

Solution (Python):
from sys import stdin

n = int(stdin.readline().strip())
li = list(map(int, stdin.readline().split()))

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

print(ans)

Solution (Python):
if __name__ == "__main__":
    N = input().rstrip().split(' ')
    N = int(N[0])
    line = input().rstrip().split(' ')
    count = 0
    skip_flag = False
    for i in range(len(line)-1):
        if skip_flag:
            skip_flag = False
            continue
        if line[i] == line[i+1]:
            count += 1
            skip_flag = True
    print(count)

Solution (Python):
n = int(raw_input())
a = map(int, raw_input().split())
dp = [0, 0]
p = -1
for x in a:
    if p == x:
        dp = [dp[1], min(dp[0], dp[1]) + 1]
    else:
        dp = [min(dp[0], dp[1]), min(dp[0], dp[1]) + 1]
    p = x
print min(dp)

Solution (Python):

import sys
import math
import numpy as np
import itertools

n = int(input())

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

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

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

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

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

print(count)

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

ans = 0
temp = 200000
c = 0
for i in a:
    if temp != i:
        ans += c//2
        c = 0
    c += 1
    temp = i
ans += c//2
print(ans)

Solution (Python):

 
def main():
	n = int(input())
	nums = list(map(int, input().split()))

	ans = 0
	flag = 0
	for i in range(n - 1):

		if flag == 1:
			flag = 0
			continue

		if nums[i + 1] == nums[i]:
			ans += 1
			flag = 1


	print(ans)

if __name__ == '__main__':
	main()

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

count = 0

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

print(count)

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

count = 0

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

Solution (Python):
from sys import stdin
n = int(stdin.readline())
a = map(int,stdin.readline().split(' '))

res, l, r = 0, 0, 0
while r < n:
  l = r
  while r+1 < n and a[r+1] == a[l]:
    r += 1
  res += (r - l + 1) / 2
  r += 1
print res

Solution (Python):


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

c =0
k = 0

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

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

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

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

print(ans)

Solution (Python):



def solve():
    n = int(input())
    al = [int(i) for i in input().split()]
    ans = 0
    for i in range(n - 1):
        if al[i] == al[i + 1]:
            ans += 1
            al[i + 1] = 99999
    print(ans)

if __name__=="__main__":
    solve()

Solution (Python):
import sys

sys.stdin.readline()
As= map(int, sys.stdin.readline().split())
last = None
cnt = 0
for a in As:
    if last is not None and a == last:
        cnt += 1
        last = None
    else:
        last = a
print(cnt)

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

Solution (Python):

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

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

print(res)

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

Solution (Python):
def main():
    ret = 0
    n = int(input())
    a = list(map(int, input().split()))
    current = a[0]
    temp = 1
    for i in a[1:]:
        if i != current:
            ret += temp // 2
            temp = 1
            current = i
        else:
            temp += 1
    print(ret + temp // 2)
    return 0
main()

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


count = 0

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


print(count)

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

continum = 0
prev_num = 0

a.append(-1)
ans = 0
for a_i in a:
    if prev_num == a_i:
        continum += 1
    else:
        ans += max(0, (continum)//2)
        continum = 1
        prev_num = a_i

print(ans)

Solution (Python):

def inpl(): return map(int, input().split())
N = int(input())
A = list(inpl()) + [0]

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

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

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

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

print(cnt)

Solution (Python):
def read_ints():
    return [int(c) for c in input().split()]


def main():
    n = int(input())
    xs = read_ints()
    accs = []
    prev = -1
    cur = 0
    for x in xs:
        if x != prev:
            accs.append(cur)
            cur = 0
        cur += 1
        prev = x
    accs.append(cur)

    ans = sum(acc // 2 for acc in accs)
    print(ans)
    return


if __name__ == '__main__':
    main()

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

Solution (Python):

N = int(input())
a_list = list(map(int, input().split()))
res = 0
cnt = 1
for i in range(1, N):
    if a_list[i] == a_list[i-1]:
        cnt += 1
    else:
        res += cnt // 2
        cnt = 1
res += cnt // 2
print(res)

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

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

b = 0
c = 0

for i in range(n):
  if(b == slime[i]):
    c += 1
    b = 0
  else:
    b = slime[i]

print(c)

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

k=0
t=0
ans=0
for i in range(n):
	if a[i]==k:
		t+=1
	else:
		ans+=t//2
		k=a[i]
		t=1
ans+=t//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]:
        A[i] = 10 ** 4
        count += 1
print(count)

Solution (Python):
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

N = read()
a = reads()
a.append(-1)

ans = 0

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

Solution (Python):

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

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

prev = -1
seq = 1
ans = 0
for a in src:
    if prev == a:
        seq += 1
    else:
        ans += seq//2
        seq = 1
    prev = a

if seq > 1:
    ans += seq//2
print(ans)

Solution (Python):

    
def main():
    n = int(input())
    a = [int(x) for x in input().split(' ')]

    ans = 0
    i = 0
    while i < n:
        j = i
        while j < n and a[i] == a[j]: j += 1
        ans += (j - i) // 2
        i = j
    print(ans)

if __name__ == '__main__':
    main()

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

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

print(Ans)

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

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()))
count = 0

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

print(count)

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

cnt = 0;
prev = -1
aa = []
for ai in a:
    if ai != prev:
        aa.append(cnt)
        cnt = 1
    else:
        cnt += 1
    prev = ai

aa.append(cnt)

ans = 0
for aai in aa:
    ans += aai // 2

print(ans)

Solution (Python):
from sys import stdin, stdout

n = int(stdin.readline())
values = list(map(int, stdin.readline().split()))
ans = 0

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

stdout.write(str(ans))

Solution (Python):
N=int(input())
A=[int(i) for i in input().split()]
L=[[A[0]]]
k=0
for i in range(1,N):
    if A[i-1]==A[i]:
        L[k].append(A[i])
    else:
        L.append([])
        k+=1
        L[k].append(A[i])
ans=0
for p in L:
    ans+=len(p)//2
print(ans)

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())
a = list(map(int,input().split()))
c = 0
p = 0
for x in range(n):
    if p == a[x]:
        c += 1
        p = 0
    else:
        p = a[x]
print(c)

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

Solution (Python):
n = int(input())
arr = map(int,raw_input().split())

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

print ans

Solution (Python):



import sys

def rl(proc=None):
    if proc is not None:
        return proc(sys.stdin.readline())
    else:
        return sys.stdin.readline().rstrip()

def srl(proc=None):
    if proc is not None:
        return map(proc, rl().split())
    else:
        return rl().split()

def main():
    rl()
    A = srl(int)
    p = 0
    c = 1
    ret = 0
    for x in A:
        if x == p:
            c += 1
        else:
            ret += c / 2
            p = x
            c = 1
    ret += c / 2
    print ret


if __name__ == '__main__':
    main()

Solution (Python):
N=int(raw_input())
A=[int(x) for x in raw_input().split()]
ans=0
for i in range(1,N):
    if A[i]==A[i-1]:
        ans+=1
        A[i]=999999
print ans

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

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