local function read_array(n,m)m=m or 1 r={}for i=1,m do r[i]={}end for i=1,n do for j=1,m do r[j][i]=io.read"*n"end end return unpack(r)end

N=io.read"*n"
A=read_array(N)

s=0
i=2
while(i<=N)do
if(A[i]==A[i-1])then s=s+1 i=i+1 end
i=i+1
end

print(s)