n=int(input())

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

cnt=[0]*(max(a)+1)

for i in range(n):

    cnt[a[i]]+=1

for i in range(max(a)+1):

    while cnt[i]>=3:

        cnt[i]=cnt[i]/3+cnt[i]%3

ans=0

cnt1=0

cnt2=0

tmp=0

for i in range(max(a)+1):

    if cnt[i]==2:

        cnt2+=1

        tmp+=2

    if cnt[i]==1:

        cnt1+=1

if cnt2%2==1:

    print((cnt1+tmp/2-1))

else:

    print((cnt1+tmp/2))

n=int(input())

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

cnt=[0]*(10**5+1)

for i in range(n):

    cnt[a[i]]+=1

cnt1=0

cnt2=0

for i in range(10**5+1):

    if cnt[i]==0:continue

    if cnt[i]%2==0:

        cnt2+=1

    else:

        cnt1+=1

if cnt2%2==0:

    print(cnt1+cnt2)

else:

    print(cnt1+cnt2-1)

n = int(input())
a = list(map(int, input().split()))
cnt = [0] * (max(a) + 1)
for i in range(n):
    cnt[a[i]] += 1
for i in range(max(a) + 1):
    while cnt[i] >= 3:
        cnt[i] = cnt[i] / 3 + cnt[i] % 3
ans = 0
cnt1 = 0
cnt2 = 0
tmp = 0
for i in range(max(a) + 1):
    if cnt[i] == 2:
        cnt2 += 1
        tmp += 2
    if cnt[i] == 1:
        cnt1 += 1
if cnt2 % 2 == 1:
    print((cnt1 + tmp / 2 - 1))
else:
    print((cnt1 + tmp / 2))

n = int(input())
a = list(map(int, input().split()))
cnt = [0] * (10**5 + 1)
for i in range(n):
    cnt[a[i]] += 1
cnt1 = 0
cnt2 = 0
for i in range(10**5 + 1):
    if cnt[i] == 0:
        continue
    if cnt[i] % 2 == 0:
        cnt2 += 1
    else:
        cnt1 += 1
if cnt2 % 2 == 0:
    print(cnt1 + cnt2)
else:
    print(cnt1 + cnt2 - 1)

-cnt = [0] * (max(a) + 1) +cnt = [0] * (10**5 + 1) -for i in range(max(a) + 1): -    while cnt[i] >= 3: -        cnt[i] = cnt[i] / 3 + cnt[i] % 3 -ans = 0 -tmp = 0 -for i in range(max(a) + 1): -    if cnt[i] == 2: +for i in range(10**5 + 1): +    if cnt[i] == 0: +        continue +    if cnt[i] % 2 == 0: -        tmp += 2 -    if cnt[i] == 1: +    else: -if cnt2 % 2 == 1: -    print((cnt1 + tmp / 2 - 1)) +if cnt2 % 2 == 0: +    print(cnt1 + cnt2) -    print((cnt1 + tmp / 2)) +    print(cnt1 + cnt2 - 1)