a = int(input(''))
b = []
d = 0
e = 0
f = 0
for i in range(a):
    c = int(input(''))
    b.append(c)
for j in b:
    if c == j:
        b.remove(j)
    c = j
for x in range(b):
    if x = f:
        d = f
        b[x] = b[x-1]
        b[x-1] = d
        e += 1
    f += 1
print(e)