n=int(input())
lista=list(map(int,input().split(' ')))
ile=0
lista1=lista
for i in range(n):
    b=0
    a=-1
    while True:
        a+=1
        if lista==[] or a==n:
            break
        if len(lista1)==1:
            break
        elif lista1[0]==lista1[a] and not 0>a and not 0==a:
            ile+=1
            d=lista1[0]
            if lista1.count(d)>2:
                c=lista1.count(d)%2
                if c==0:
                    continue
                else:
                    del lista1[0]
                    ile-=1
                    a=0
            if not lista1==[]:
                del lista1[a]
            del lista1[0]
            a=0
    if len(lista1)==1:
        break
print(ile)
        1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31  | n=int(input()) lista=list(map(int,input().split(' '))) ile=0 lista1=lista for i in range(n): b=0 a=-1 while True: a+=1 if lista==[] or a==n: break if len(lista1)==1: break elif lista1[0]==lista1[a] and not 0>a and not 0==a: ile+=1 d=lista1[0] if lista1.count(d)>2: c=lista1.count(d)%2 if c==0: continue else: del lista1[0] ile-=1 a=0 if not lista1==[]: del lista1[a] del lista1[0] a=0 if len(lista1)==1: break print(ile)  | 
            
        
                    English