n =int(input())
a =list(map(int,input().split()))
st ={}for x in a:if x notin st:
st[x]=1else:
st[x]+=1
ans, c1, c2 =0,0,0for x, y in st.items():if y >2:
c2 +=(y -2)elif y ==1:
c1 +=1if c1 < c2:print(c2)else:print(c2 +(c1 - c2)//2)
3、Java
importjava.util.*;publicclassMain{publicstaticvoidmain(String[] args){Scanner sc =newScanner(System.in);int n = sc.nextInt();List<Integer> a =newArrayList<>();Map<Integer,Integer> st =newHashMap<>();for(int i =0; i < n; i ++){int x = sc.nextInt();
a.add(x);if(st.get(x)!=null)
st.put(x, st.get(x)+1);else
st.put(x,1);}int ans =0, c1 =0, c2 =0;for(Map.Entry<Integer,Integer> x: st.entrySet()){if(x.getValue()>2){
c2 += x.getValue()-2;}elseif(x.getValue()==1){
c1 +=1;}}if(c1 < c2){System.out.println(c2);}else{System.out.println(c2 +(c1 - c2)/2);}}}