n=int(input())
m=0
L=sorted(list(map(int,input().split())))
x=sum(L)
for i in range(n):
    num=L[i]
    m=m+num
    if 2*m>x:
        print(i+1)
        break


n=int(input())
m=0
L=sorted(list(map(int,input().split())))
x=sum(L)
for i in range(n):
    if 2*m>x:
        print(i+1)
    else:
        num=L[i]
        m=m+num


n=int(input())
m=0
L=sorted(list(map(int,input().split())))
L.reverse()
x=sum(L)
for i in range(n):
    num=L[i]
    m=m+num
    if 2*m>x:
        print(i+1)
        break


n=int(input())
l=[int(x) for x in input().split()]
total=sum(l)
l.sort(reverse=True)
you=0
for i in range(n):
  you=you+l[i]
  if 2*you>total:
    print(i+1)
    break


n=int(input())
m=0
L=sorted(list(map(int,input().split())))
x=sum(L)
for i in range(n):
    num=L[i]
    m=m+num
    if 2*m>x:
        print(n-i)
        break


import itertools
num = int(input())
coins = [int(s) for s in input().split(' ')]
coins = sorted(coins)
coins = coins[::-1]
aux = coins.copy()
norep = []
found = False

for L in range(1, num + 1):
    for subset in itertools.combinations(coins, L):
        if subset not in norep:
            norep.append(subset)
            for i in subset:
                if i in aux:
                    aux.remove(i)
            if sum(subset) > sum(aux):
                dif = len(subset)
                found = True
                break
            aux = coins.copy()
    if found:
        break

print(dif)


num = int(input())
coins = [int(s) for s in input().split(' ')]
dif = []

# todos as diferenças entre a soma de moedas escolhidas e a soma das restantes

for j in range(num):
    for i in range(num):
        if sum(coins[j:i+1]) - (sum(coins[j+i+1:]) + sum(coins[:j])) > 0:
            dif.append(len(coins[j:i+1]))
            break

print(min(dif))


num = int(input())
coins = [int(s) for s in input().split(' ')]
coins = sorted(coins)[::-1]
found = False

for i in range(num):
    if sum(coins[:i+1]) - (sum(coins[i+1:])) > 0:
        dif = len(coins[:i+1])
        break

print(dif)


num = int(input())
coins = [int(s) for s in input().split(' ')]
dif = []

# todos as diferenças entre a soma de moedas escolhidas e a soma das restantes

for j in range(num):
    for i in range(num):
        print(coins[j+i+1:] + coins[:j])
        if sum(coins[j:i+1]) - (sum(coins[j+i+1:]) + sum(coins[:j])) > 0:
            dif.append(len(coins[j:i+1]))
            break

print(min(dif))


import itertools
num = int(input())
coins = [int(s) for s in input().split(' ')]
aux = coins.copy()
dif = []
norep = []

for L in range(1, num + 1):
    for subset in itertools.combinations(coins, L):
        if subset not in norep:
            norep.append(subset)
            for i in subset:
                if i in aux:
                    aux.remove(i)
            if sum(subset) > sum(aux):
                dif.append(len(subset))
                break
            aux = coins.copy()

print(min(dif))


import itertools
num = int(input())
coins = [int(s) for s in input().split(' ')]
aux = coins.copy()
dif = []

for L in range(1, len(coins)+1):
    for subset in itertools.permutations(coins, L):
            for i in range(len(subset)):
                aux.remove(subset[i])
            if sum(subset) > sum(aux):
                dif.append(len(subset))
            aux = coins.copy()

print(min(dif))


num = int(input())
coins = [int(s) for s in input().split(' ')]
dif = []

# todos as diferenças entre a soma de moedas escolhidas e a soma das restantes

for j in range(num):
    for i in range(num):
        if sum(coins[j:i+1]) - (sum(coins[j+i+1:]) + sum(coins[:j])) >= 0:
            dif.append(len(coins[j:i+1]))
            break

print(min(dif))


num = int(input())
coins = [int(s) for s in input().split(' ')]
dif = 0

# todos as diferenças entre a soma de moedas escolhidas e a soma das restantes

for i in range(num):
    if sum(coins[:i+1]) - sum(coins[i+1:]) > 0:
        dif = len(coins[:i+1])
        break

print(dif)


n = int(input())
coins = [int(i) for i in input().split()]
summ = 0
S = sum(coins)
coins.sort()
coins[::-1]
for a in range(n):
    if summ <= sum(coins[a + 1:n]):
        summ += coins[a]
    else:
        break
if n==1:
    print(1)
else:
    if summ == (S-summ):
        print(a+1)
    else:
        print(a)


def solve(n , arr):

    arr.sort()
    pre_sum = [0]

    total_sum = sum(arr)

    for i in range(n):
        pre_sum.append(pre_sum[-1] + arr[i])

    pre_sum.pop(0)

    for i in range(n):
        if pre_sum[i] > total_sum/2:
            return i + 1

n = int(input())
arr = list(map(int , input().split()))
print(solve(n , arr))


def solve(n , arr):

    arr.sort(reverese = True)
    pre_sum = [0]

    total_sum = sum(arr)

    for i in range(n):
        pre_sum.append(pre_sum[-1] + arr[i])

    pre_sum.pop(0)

    for i in range(n):
        if pre_sum[i] > total_sum/2:
            return i + 1

n = int(input())
arr = list(map(int , input().split()))
print(solve(n , arr))


def solve(n , arr):

    arr.sort(reverse = True)
    pre_sum = [0]

    total_sum = sum(arr)

    for i in range(n):
        pre_sum.append(pre_sum[-1] + arr[i])

    pre_sum.pop(0)

    for i in range(n):
        if pre_sum[i] > total_sum/2:
            return i + 1

n = int(input())
arr = list(map(int , input().split()))
print(solve(n , arr))


n = int(input())
coins = [int(i) for i in input().split()]
summ = 0

coins.sort(reverse = True)

for i in range(n):
    summ += coins[i]
    if summ > sum(coins)/2:
        print(i+1)
        break


n = int(input())
coins = [int(i) for i in input().split()]
summ = 0
S = sum(coins)
coins.sort()

for a in range(n):
    if summ <= sum(coins[a + 1:n]):
        summ += coins[a]
    else:
        break
if n==1:
    print(1)
else:
    if summ == (S-summ):
        print(a+1)
    else:
        print(a)


n = int(input())
coins = [int(i) for i in input().split()]
summ = 0

coins.sort()

for a in range(n):
    if summ <= sum(coins[a+1:n]):
        summ += coins[a]
    else:
        break

print(a)


n = int(input())
coins = [int(i) for i in input().split()]
summ = 0

coins.sort()
total = sum(coins)
for a in range(n):
    if summ <= total/2:
        summ += coins[a]
    else:
        break

print(a + 1)


import sys
n=int(input())
b=list(map(int,input().split()))
a= sorted(b, reverse=True)
s=0
p=0
k=1
c=0

if n==2:
    print("2")
    sys.exit()
if n==1:
    print("1")
    sys.exit()
for i in range(0,n):
    s=s+a[i]

for i in range(0,n-1):
    for k in range(i,i+1):
       p=p+a[k]
       c=c+1
       if p>s-p:
            print(c)
            sys.exit()


import sys
n=int(input())
b=list(map(int,input().split()))
a= sorted(b, reverse=True)
s=0
p=0
k=1
c=0
print(a)
if n==2:
    print("2")
    sys.exit()
if n==1:
    print("1")
    sys.exit()
for i in range(0,n):
    s=s+a[i]

for i in range(0,n-1):
    for k in range(i,i+1):
       p=p+a[k]
       c=c+1
       if p>s-p:
            print(c)
            sys.exit()


import sys
n=int(input())
b=list(map(int,input().split()))
a= sorted(b, reverse=True)
s=0
p=0
k=1
c=0

if n==1:
    print("1")
    sys.exit()
for i in range(0,n):
    s=s+a[i]

for i in range(0,n-1):
    for k in range(i,i+1):
       p=p+a[k]
       c=c+1
       if p>s-p:
            print(c)
            sys.exit()


import sys
n=int(input())
b=list(map(int,input().split()))
a= sorted(b, reverse=True)
s=0
p=0
k=1
c=0
if n==1:
    print("1")
    sys.exit()
if n==2 and a[0]==a[1]:
    print("2")
    sys.exit()
if n==2 and a[0]!=a[1]:
    print("1")
    sys.exit()

for i in range(0,n):
    s=s+a[i]

for i in range(0,n-1):
    for k in range(i,i+1):
       p=p+a[k]
       c=c+1
       if p>s-p:
            print(c)
            sys.exit()


import sys
n=int(input())
b=list(map(int,input().split()))
a= sorted(b, reverse=True)
s=0
p=0
k=1
c=0
if n==1:
    print("1")
    sys.exit()
if n==2 and a[0]==a[1]:
    print("2")
if n==2 and a[0]!=a[1]:
    print("1")

for i in range(0,n):
    s=s+a[i]

for i in range(0,n-1):
    for k in range(i,i+1):
       p=p+a[k]
       c=c+1
       if p>s-p:
            print(c)
            sys.exit()


import sys
n=int(input())
c=0
b=list(map(int,input().split()))
if n==2:
    print("2")
a= sorted(b, reverse=True)
s=0
p=0
k=1
for i in range(0,n):
    s=s+a[i]

for i in range(0,n):
    for k in range(0,i):
       p=p+a[i]
       c=c+1
       if p>s-p:
            print(c)
            sys.exit()
       else:
            k=k+1


import sys
n=int(input())
c=0
b=list(map(int,input().split()))
if n==2:
    print("2")
    sys.exit()
if n==1:
    print("1")
    sys.exit()
a= sorted(b, reverse=True)
s=0
p=0
k=1
for i in range(0,n):
    s=s+a[i]

for i in range(0,n):
    for k in range(0,i):
       p=p+a[i]
       c=c+1
       if p>s-p:
            print(c)
            sys.exit()
       else:
            k=k+1


'''groups = int(input())
members = list(map(int,input().split()))
length = len(members)
i=0
j=i+1
count = 0
while i<length
    gap = 4 - members[i]
    while j<length:
        if gap == members[j]:
            count += 1
            break
        j += 1'''

x = int(input())
coins = list(map(int,input().split(" ")))
#print(coins)
total_coins = len(coins)
#print(sorted(coins))
coins = sorted(coins)
my_coins = coins[0]
count = 1
j=1
while my_coins <= coins[total_coins - 1] :
    my_coins += coins[j]
    count +=1
    j +=1
print(count)


'''groups = int(input())
members = list(map(int,input().split()))
length = len(members)
i=0
j=i+1
count = 0
while i<length
    gap = 4 - members[i]
    while j<length:
        if gap == members[j]:
            count += 1
            break
        j += 1'''

x = int(input())
coins = list(map(int,input().split(" ")))
#print(coins)
total_coins = len(coins)
#print(sorted(coins))
coins = sorted(coins)
my_coins = coins[0]
count = 1
j=1
if len>1:
    while my_coins <= coins[total_coins - 1] :
    my_coins += coins[j]
    count +=1
    j += 1

print(count)


'''groups = int(input())
members = list(map(int,input().split()))
length = len(members)
i=0
j=i+1
count = 0
while i<length
    gap = 4 - members[i]
    while j<length:
        if gap == members[j]:
            count += 1
            break
        j += 1'''

x = int(input())
coins = list(map(int,input().split(" ")))
#print(coins)
total_coins = len(coins)
#print(sorted(coins))
coins = sorted(coins,reverse=True)
#print(coins)
my_coins = coins[0]
count = 1
j=1
sum = 0
for i in range(total_coins):
    sum += coins[i]
#print("total value =",sum)
gap = sum - my_coins

if total_coins > 1:
    while my_coins <= gap:
        my_coins += coins[j]
        gap -= coins[j]
        count +=1
        j +=1

print(count)


'''groups = int(input())
members = list(map(int,input().split()))
length = len(members)
i=0
j=i+1
count = 0
while i<length
    gap = 4 - members[i]
    while j<length:
        if gap == members[j]:
            count += 1
            break
        j += 1'''

x = int(input())
coins = list(map(int,input().split(" ")))
#print(coins)
total_coins = len(coins)
#print(sorted(coins))
coins = sorted(coins,reverse=True)
#print(coins)
my_coins = coins[0]
count = 1
j=1
sum = 0
for i in range(total_coins):
    sum += coins[i]
#print("total value =",sum)
gap = sum - my_coins

if total_coins > 1:
    while my_coins <= gap:
        my_coins += coins[j]
        count +=1
        j +=1

print(count)


'''groups = int(input())
members = list(map(int,input().split()))
length = len(members)
i=0
j=i+1
count = 0
while i<length
    gap = 4 - members[i]
    while j<length:
        if gap == members[j]:
            count += 1
            break
        j += 1'''

x = int(input())
coins = list(map(int,input().split(" ")))
#print(coins)
total_coins = len(coins)
#print(sorted(coins))
coins = sorted(coins,reverse=True)
#print(coins)
my_coins = coins[0]
count = 1
j=1
sum = 0
for i in range(total_coins):
    sum += coins[i]
#print("total value =",sum)
gap = sum - my_coins

if total_coins > 1:
    while my_coins < gap:
        my_coins += coins[j]
        count +=1
        j +=1

print(count)


n, k = gets.split(' ').map(&:to_i)
a = gets.split(' ').map(&:to_i)

puts(a.select { |x| x <= 5-k }.size.div(3))


i=->{gets.split.map(&:to_i)}
_,k=i[]
p i[].collect{|x|x<6-k}.size/3


i=->{gets.split.map(&:to_i)}
_,k=i[]
p i[].select{|x|x<6-k}.size/3


x=map(int,raw_input().split())
k,n=x[1],x[0]
x=map(int,raw_input().split())
x.sort()
ye=len(x)
fo=0
for i in range(-1,-ye-1,-1):
    if x[i]<=5-k:
        ye=x[i]
        fo=1
    if fo==1:
        break
if n+i+1>0 :
    print (len(x)+i+1)/3
else: print 0


x=map(int,raw_input().split())
k,n=x[1],x[0]
x=map(int,raw_input().split())
x.sort()
ye=len(x)
fo=0
for i in range(-1,-ye-1,-1):
    if x[i]<=5-k:
        ye=x[i]
        fo=1
    if fo==1:
        break
if len(x)+i+1>0 and (len(x)+i+1)%3==0:
    print (len(x)+i+1)/3
else: print 0


import os,sys

inp = raw_input().split()
inp = [int(x) for x in inp]

n = inp[0]
k = inp[1]

arr = raw_input().split()
arr = [int(x) for x in arr]

arr.sort()

count = n / 3

result = 0
i = 0
while count:
    if arr[i+2] + k <= 5:
        result += 1

    i = i+3
    count -= 1
print result


import os,sys

inp = raw_input().split()
inp = [int(x) for x in inp]

n = inp[0]
k = inp[1]

arr = raw_input().split()
arr = [int(x) for x in arr]

arr.sort()

count = n / 3

result = 0
for i in range(0,n,3):
    #print i
    if (arr[i+2] + k) <= 5:
        result += 1
        #arr[i] += k
        #arr[i+1] += k
        #arr[i+2] += k

print result


n,k=map(int,raw_input().split())
a=map(int,raw_input().split())
c=0
a=sorted(a)
for i in a:
    if (i+k)<=5:
        c=c+1
print c/3


def solve():
    n, k = [int(x) for x in raw_input().split()]
    y = [int(x) for x in raw_input().split()]
    c = 0
    for i in y:
        if i <= 5-k:
            c += 1
    print c // 3

solve()


n,k=map(int,raw_input().split())
A=map(int,raw_input().split())
sum=0
for i in A:
	if i+k<=5:
		sum+=1
print int(sum/3)


def solve(n,k,par):
    par = sorted(par)
    teams = 0
    for i in xrange(0,n,3):
        if(i+1<n and i+2<n):
            pl1 = par[i]+k
            pl2 = par[i+1]+k
            pl3 = par[i+2]+k
            if(pl1<=5 and pl2<=5 and pl3<=5):
                teams+=1

    print teams

if __name__ == "__main__":
    n,k = map(int,raw_input().split(" "))
    par = map(int,raw_input().split(" "))
    solve(n,k,par)


N, K = [int(i) for i in raw_input().split()]

studs = [int(i) for i in raw_input().split()]

elig = [i for i in studs if i + K <= 5]

x = len(elig)
t = x / 3

print t


name = map(int, raw_input('').split())
numbers = map(int, raw_input('').split())
numbers = [i + name[1] for i in numbers]
numbers = [i for i in numbers if i <5]
print len(numbers) //3


name = map(int, raw_input('').split())
numbers = map(int, raw_input('').split())
numbers = [i + name[1] for i in numbers]
numbers = [i for i in numbers if i <=5]
print len(numbers) //3


string1 = raw_input().split(' ')
string1 = map(lambda x:int(x),string1)
string2 = raw_input().split(' ')
string2 = map(lambda x:int(x),string2)
ans = filter(lambda x:x<=5-string1[1],string2)
print len(ans)/3


n,k = map(int , raw_input().split())
x = map(int , raw_input().split())
new = []
for i in x:
    if(i <= (5-k)):
        new.append(i)
print len(new)//3


from sys import stdin

data = []

for line in stdin:
    z = [int(x) for x in line.split()]
    data.append(z)

n = data[0][0]
k = data[0][1]

threshold = 0

for x in data[1]:
    if x+k>5: threshold+=1

print (n - threshold)/3


n,k = map(int,raw_input().split())
y = map(int,raw_input().split())
print len([x for x in y if x+k<=5])/3


n, k = map(int, raw_input().split())
list1 = map(int, raw_input().split())
sum1 = 0
for i in range(0, n):
    if list1[i] <= 5-k:
        sum1 += 1
print sum1/3


k, n = map(int, raw_input().split(' '))
participants = map(int, raw_input().split(' '))

#solution
participants = sorted(participants)
answer = 0

def my_range(start, end, step):
    while start <= end:
        yield start
        start += step

for i in my_range(3, k, 3):
    if(participants[i-1] + n <= 5):
        answer += 1
print(answer)


f = lambda : map(int,raw_input().split())
n,k = f()
print sum(5-i>=k for i in f())/3


n,k = map(int,raw_input().split())
a = sorted(map(int,raw_input().split()))
i = 2;ans = 0
if(n>2):
    while(5-a[i]>=k):
        ans += 1
        if(i+3 <= n-1): i+=3
        else:   break
print ans


n,k = map(int,raw_input().split())
a = sorted(map(int,raw_input().split()))
i = 2;ans = 0
if(n>3):
    while(5-a[i]>=k):
        ans += 1
        if(i+3 <= n-1): i+=3
        else:   break
print ans


str=raw_input()
n=int(str.split(" ")[0])
k=int(str.split(" ")[1])
str2=raw_input()
t=[]
for i in range(0,n):
    t.append(int(str2.split(" ")[i]))
sum=0
for i in range(0,n):
    a=int(t[i])+k
    if a<=5:
        sum+=1
print int(sum/3)


str=raw_input()
n=int(str.split(" ")[0])
k=int(str.split(" ")[1])
str2=raw_input()
t=[]
for i in range(0,n):
    t.append(int(str2.split(" ")[i]))
for i in range(0,n):
    a=int(t[i])+k
    if a>5:
        del t[i]
print t
print int(len(t)/3)


a = raw_input()
a = a.split()

n = int(a[0])
k = int(a[1])

lst = raw_input()
lst = lst.split()

lst.sort()
num=0

while(num<n and str(5-k)>=lst[num]):
	num += 1
	print num

ans = num/3
print ans


a = raw_input()
a = a.split()

n = int(a[0])
k = int(a[1])

lst = raw_input()
lst = lst.split()

lst.sort()
num=0

while(str(5-k)>=lst[num]):
	num += 1

ans = num/3
print ans


a = raw_input()
a = a.split()

n = int(a[0])
k = int(a[1])

lst = raw_input()
lst = lst.split()

lst.sort()
num=0

while(num<n and str(5-k)>=lst[num]):
	num += 1

ans = num/3
print ans


def fn():
    n,k = map(int,raw_input().split())
    a = map(int,raw_input().split())
    count,i = 0,2
    if n<3:
        print 0
        return
    a.sort()
    while i<n:
        if a[i]+k<=5:
            count+=1
        i+=3
    print count
fn()


def fn():
    n,k = map(int,raw_input().split())
    a = map(int,raw_input().split())
    count,i = 0,2
    if n<3:
        print 0
        return
    a.sort()
    while i<n:
        if a[i]*k<=5:
            count+=1
        i+=3
    print count


def fn():
    n,k = map(int,raw_input().split())
    a = map(int,raw_input().split())
    count,i = 0,2
    if n<3:
        print 0
        return
    a.sort()
    while i<n:
        if a[i]*k<=5:
            count+=1
        i+=3
    print count
fn()


n, k = map(int, raw_input().split())
l = map(int, raw_input().split())
ans = 0
for i in l:
	if 5-i >= k:
		ans += 1
print ans/3


n,k = map(int,raw_input().split())

inp=raw_input().split()

students=[]

for i in inp:
   students.append(int(i))

ntimes=0
students.sort()

while ntimes<k:
   for i in range(n):
      if students[i]!=-1:
         students[i]+=1
      if students[i]>5:
         students[i]=-1
   ntimes+=1
   #print students

current=len(students)

print (current-students.count(-1))/3


n,k = map(int,raw_input().split())

inp=raw_input().split()

students=[]

for i in inp:
   students.append(int(i))

ntimes=0
students.sort()

while ntimes<k:
   #print students
   for i in range(n):
      if i<len(students):
         students[i]+=1
      if i <len(students) and students[i]>5:
         students.pop(i)
   ntimes+=1

current=len(students)

while ntimes<4:
   #print students
   for i in range(n):
      if i<len(students):
         students[i]+=1
      if i <len(students) and students[i]>5:
         students.pop(i)
   ntimes+=1

#print students

print (len(students)/3) + ((current-len(students))/3)


n,k = map(int,raw_input().split())

inp=raw_input().split()

students=[]

for i in inp:
   students.append(int(i))

ntimes=0
students.sort()

while ntimes<k:
   for i in range(n):
      if i<len(students):
         students[i]+=1
      if i <len(students) and students[i]>5:
         students.pop(i)
   ntimes+=1

print len(students)/3


n,k=map(int,raw_input().split(" "))
ar=sorted(map(int,raw_input().split(" ")))
if n<3:
	print 0
else:
	i,count=-1,0
	while i+3<n:
		i+=3
		if ar[i]+k<=5:
			count+=1
		else:
			break
	print count


a,b=map(int,raw_input().split())
c=map(int,raw_input().split())
i=0
while i<a:
    c[i]+=b
    i+=1
c.sort()
while max(c)>5:
    c.pop()
print (len(c)/3)


a,b=map(int,raw_input().split())
c=map(int,raw_input().split())
i=0
while i<a:
    c[i]+=b
    i+=1
c.sort()
try:
    while max(c)>5:
        c.pop()
    print (len(c)/3)
except:
    print (len(c)/3)


n,k=map(int,raw_input().split())
a=[int(i) for i in raw_input().split()]
c=0
for i in a:
    if i+k<=5:
        c+=1
print c/3


n,k=map(int,raw_input().split())
a=[int(i) for in raw_input().split()]
for i in a:
    if i+k<=5:
        c+=1
print c/3


n,k=map(int,raw_input().split())
a=[int(i) for in raw_input().split()]
c=0
for i in a:
    if i+k<=5:
        c+=1
print c/3


n,k = map(int,raw_input().split())
a = [int(i) for i in raw_input().split()]
mu = 0
for pu in a:
    if pu+k <= 5:
        mu+=1
print mu/3


b=map(int,raw_input().split(' '))
n=b[0]
k=b[1]
ans=0
b=map(int,raw_input().split(' '))
for i in range(n):
    if b[i]<=5-k:
        ans+=1
print ans//3


n,k = map(int, raw_input().split()) ; y = map(int , raw_input().split())
p = [ x for x in y if x+k<=5]
print len(p)/3


n,k = map(int, raw_input().split()); y = map(int, raw_input().split())
y = [x+k for x in y]; y= [x for x in y if x <= 5]; print len(y)/3


input=raw_input().split(" ")

k=int(input[1])

input=raw_input().split(" ")
input_arr=[int(t) for t in input]

count=0
for t in input_arr:
    if t+k<=5:
        count+=1

print(count/3)


from collections import Counter

n, k = map(int, raw_input().strip().split())
num_parts = Counter(map(int, raw_input().strip().split()))

count = 0

k = 5-k

while k > -1:
	count += num_parts[k]
	k -= 1

print count/3
# Woah


from collections import Counter

n, k = map(int, raw_input().strip().split())
num_parts = Counter(map(int, raw_input().strip().split()))

count = 0

k = 5-k

while k > -1:
	count += num_parts[k]
	k -= 1

print count/3


a, b = map(int, raw_input().split(" "))
lis = map(int, raw_input().split(" "))
cnt = 0
for i in range(len(lis)):
    if 5-lis[i]>=b:
        cnt+=1
print cnt/3


n,k=map(int,raw_input().split())
s=map(int,raw_input().split())
s.append(-1)
s.sort()
i=0
ma=0
while(i+3<len(s)):
	if(s[i+3]*k<=5):
		ma+=1
	else:
		break
	i+=3
print ma


n,k=map(int,raw_input().split())
s=map(int,raw_input().split())
s.append(-1)
s.sort()
i=0
ma=0
while(i+3<len(s)):
	if(s[i+3]+k<=5):
		ma+=1
	else:
		break
	i+=3
print ma


n,k=tuple(map(int,raw_input().split()))
a=map(int,raw_input().split())
cnt=0
for member in a:
    if member <= 5 - k:
        cnt+=1
print cnt/3


n,k=tuple(map(int,raw_input().split()))
a=map(int,raw_input().split())
cnt=0
for member in a:
    if member < k:
        cnt+=1
if cnt%3==0:
    print cnt/3
else:
    print 0


def main():
	in1= raw_input()
	in2= raw_input()
	n,k=int(in1.split()[0]), int(in1.split()[1])
	students=in2.split()
	for i in range(len(students)):
		students[i]= int(students[i])
	students.sort()
	trav=2
	ans=0
	allowed= 5-k
	while trav<len(students):
		#print(students[trav],allowed)
		if students[trav]<=allowed:
			ans+=1
		trav+=3

	print(ans)
	return ans

if __name__ == '__main__':
	main()


import sys,math

if __name__ == '__main__':
	[n,k] = map(int,raw_input().split())
	part = (map(int,raw_input().split()))
	part = sorted([i+k for i in part])
	ans = 0
	for i in part:
		if i > 5:
			break
		else:
			ans+=1
	print ans/3


import sys,math

if __name__ == '__main__':
	[n,k] = map(int,raw_input().split())
	part = (map(int,raw_input().split()))
	part = sorted([i+k-1 for i in part])
	ans = 0
	for i in part:
		if i > k:
			break
		else:
			ans+=1
	print ans/3


n,k=raw_input().split()
n=int(n)
k=int(k)
l=[int(x) for x in raw_input().split()]
l1=[x for x in l if(((x+k)<=5))]
print len(l1)/3


n, k = map(int, raw_input().strip().split())
arr = map(int, raw_input().strip().split())
arr.sort()
count = 0
i=0
num_team_max = len(arr)/3
for a0 in range(num_team_max):
	if arr[i]+k<=5 and arr[i+1]+k<=5 and arr[i+2]+k<=5:
		count+=1
print count


n, k = map(int, raw_input().strip().split())
arr = map(int, raw_input().strip().split())
arr.sort()
count = 0
i=0
num_team_max = len(arr)/3
for a0 in range(num_team_max):
	if arr[i]+k<=5 and arr[i+1]+k<=5 and arr[i+2]+k<=5:
		count+=1
	i+=3
print count


n, k = map(int, raw_input().split())
l = map(int, raw_input().split())
l.sort()
for i in xrange(len(l)):
    if l[i] > 5 - k:
        break
print (i + 1) / 3


n, k = map(int, raw_input().split())
l = map(int, raw_input().split())
l.sort()

t = 5 - k
p = 0
for k, v in enumerate(l):
    if v <= t:
        p = k
    else:
        break

print (p + 1)/3


n, k = map(int, raw_input().split())
l = map(int, raw_input().split())
l.sort()
for i in xrange(len(l)):
    if i > 5 - k:
        break
print i / 3


n, k = map(int, raw_input().split())
l = map(int, raw_input().split())
l.sort()
for i in xrange(len(l)):
    if i > 5 - k - 1:
        break
print i / 3


n, k = map(int, raw_input().split())
l = map(int, raw_input().split())
l.sort()
print l
for i in xrange(len(l)):
    if i > 5 - k:
        break
print i / 3


n,k = map(int,raw_input().split())
ss = map(int,raw_input().split())
a = 0
for s in ss:
	if (5-s) > k: a += 1
print a/3


n,k = map(int,raw_input().split())
ss = map(int,raw_input().split())
a = 0
for s in ss:
	if (5-s) >= k: a += 1
print a/3


def filtro(stri):
	stri = int(stri) -5 + anos
	if stri < 1:
		return stri
	else: return 30

n, anos = map(int,raw_input().split())
lista = map(filtro ,raw_input().split())
lista.sort()
while lista[-1] > 0:
	lista.pop()
	if len(lista) == 1:
		lista.pop()
		break

print len(lista)/3


def filtro(stri):
	stri = int(stri) -5 + anos
	if stri < 1:
		return stri
	else: return 30

n, anos = map(int,raw_input().split())
lista = map(filtro ,raw_input().split())
print lista
lista.sort()
print lista
while lista[-1] > 0:
	print lista
	lista.pop()
	if len(lista) == 1:
		lista.pop()
		break

print lista
print len(lista)/3


n, k = map(int, raw_input().split())
a = map(int, raw_input().split())

a.sort()
count = 0

for i in xrange(0, n, 3):
	if max(a[i:i+3]) + k <= 5:
		count += 1
	else:
		break

print count


n, k = map(int, raw_input().split())
a = map(int, raw_input().split())

a.sort()
count = 0

for i in xrange(0, n - 2, 3):
	if max(a[i:i+3]) + k <= 5:
		count += 1
	else:
		break

print count


n, k = map(int, raw_input().split(' '))
ar = map(int, raw_input().split(' '))
mem = 0
for i in ar:
	if i>=5:
		continue
	check = i+k
	if check<=5:
		mem += 1
print mem/3


sta=[int(x) for x in raw_input().split()]
lista=[int(x) for x in raw_input().split()]
n=sta[0]
k=6-sta[1]
b=0
a=0
for i in lista:
    if i<k:
        a+=1
    if a==3:
        b+=1
        a=0
print b


sta=[int(x) for x in raw_input().split()]
lista=[int(x) for x in raw_input().split()]
n=sta[0]
k=6-sta[1]
b=0
a=0
for i in lista:
    if i<k:
        a+=1
    if a==3:
        b+=1
print b


def solve(n,k,par):

    par = sorted(par)

    teams = 0

    for i in xrange(0,n,3):

        if(i+1<n and i+2<n):

            pl1 = par[i]+k

            pl2 = par[i+1]+k

            pl3 = par[i+2]+k

            if(pl1<=5 and pl2<=5 and pl3<=5):

                teams+=1

    print teams

if __name__ == "__main__":

    n,k = map(int,raw_input().split(" "))

    par = map(int,raw_input().split(" "))

    solve(n,k,par)


n,k = map(int, raw_input().split())

arr = map(int, raw_input().split())
arr.sort()
#print arr
count = 0
j = 0
for i in xrange(len(arr)/3):
    if (arr[j+2]+k <= 5):
        count += 1
    j+=3
print count


n,k = map(int, raw_input().split())

arr = map(int, raw_input().split())
arr.sort()

count = 0
for i in xrange(len(arr)/3):
    if (arr[i+2]+k <= 5):
        count += 1
print count


n = map(int, raw_input().split())
#print n
numbers = map(int, raw_input().split())
#print numbers
ans = 0
for num in numbers:
    if num<=5-n[1]:
        ans += 1
print ans/3


n, k = [int(i) for i in raw_input().split()]

players = [int(i) for i in raw_input().split()]
valid = 0

for player in players:
    years = player+k

    if years <= 5:
        valid += 1

print valid/3


n, k = [int(i) for i in raw_input().split()]

players = [int(i) for i in raw_input().split()]
valid = 0

for player in players:
    years = player+k

    if years < 5:
        valid += 1

print valid/3


# Choosing Teams

[n, k] = map(int, raw_input().split())

members = map(int, raw_input().split())

total = 0
for member in members:
    if member + k <= 5:
        total += 1

print total/3


# Choosing Teams

[n, k] = map(int, raw_input().split())

members = map(int, raw_input().split())
stat = [0, 0, 0, 0, 0, 0]

for member in members:
    stat[member] += 1

total = sum(stat)- stat[5]

for i in range(0, 5):
    if stat[i] >= k:
        judge = True
        break
    else:
        judge = False
'''
print stat
print 'team =', team
print 'total/3 =', total
'''
if judge:
    print total/3
else:
    print 0


class ChoosingTeams:
    def solve(self,n,k,arr):
        workablemembers = []
        for x in arr:
            if x==5:
                continue
            elif 5-x<k:
                continue
            else:
                workablemembers.append(x)
        return len(workablemembers)/3
if __name__ == "__main__":
    n, k = map(int, raw_input().split(" "))
    arr = map(int,raw_input().split(" "))
    ct = ChoosingTeams()
    print ct.solve(n,k,arr)


n,k=map(int,raw_input().split())
l=[x for x in raw_input().split() if int(x)+k<=5]
print len(l)/3


n,k=map(int,raw_input().split())
ans=0
l=[int(x) for x in raw_input().split()]
for i in l:
    if i+k<=5:
        ans+=1
print ans/3


n , k = [int(x) for x in raw_input().split()]
a = [int(x) for x in raw_input().split()]

m = 0

for i in range(n):
    if a[i]<=5 - k:
        k += 1

print k / 3


n , k = [int(x) for x in raw_input().split()]
a = [int(x) for x in raw_input().split()]

m = 0

for i in range(n):
    if a[i] <= (5 - k):
        m += 1

print m / 3


n,k=map(int,raw_input().split())
lst=map(int,raw_input().split())
s=0
ans=[]
for i in lst:
    i=5-i
    if i/k!=0:
        ans.append((i)/k)
ans.sort()
vl=0
#print ans
if len(ans)<3:
    print 0
else:
    #for i in range(0,n-2,3):
        #vl=vl+min(ans[i],ans[i+1],ans[i+2])
    print len(ans)/3


import math

n, k = raw_input().split()
n, k = int(n), int(k)
arr = map(int,raw_input().split())
count = 0.0

for i in range(n):
    if arr[i] + 3 < 5:
        count += 1.0

print(int(math.ceil(count / 3)))


n, k = raw_input().split()
n, k = int(n), int(k)
arr = map(int,raw_input().split())
count = 0

for i in range(n):
    if arr[i] + 3 <= 5:
        count += 1

print(count / 3)


import math

n, k = raw_input().split()
n, k = int(n), int(k)
arr = map(int,raw_input().split())
count = 0.0

for i in range(n):
    if arr[i] + 3 <= 5:
        count += 1.0

print(int(math.ceil(count / 3)))


import math

n, k = raw_input().split()
n, k = int(n), int(k)
arr = map(int,raw_input().split())
count = 0.0

for i in range(n):
    if arr[i] + k <= 5:
        count += 1.0

print(int(math.floor(count / 3)))


import math

n, k = raw_input().split()
n, k = int(n), int(k)
arr = map(int,raw_input().split())
count = 0.0

for i in range(n):
    if arr[i] + 3 < 5:
        count += 1.0

print(int(math.floor(count / 3)))


using System;
using System.Globalization;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Solve();
            p.Out(x);
        }

        object Solve()
        {
            checked
            {
                var n = ReadLong();
                if (n == 1)
                    return 1;
                var s = ReadLongs();
                var factors = new List<int>[100001];
                for (int i = 2; i < 100001; i++)
                {
                    factors[i] = new List<int>();
                }

                for (int i = 2; i <= s.Length; i++)
                {
                    if (factors[i].Count == 0)
                        for (int j = i; j < 100001; j+=i)
                        {
                            factors[j].Add(j);
                        }
                }
                var res = new int[100001];
                for (int i = 2; i < 100001; i++)
                {
                    for (int j = 0; j < factors[i].Count; j++)
                        res[factors[i][j]]++;
                }
                return Math.Max(res.Max(), 1);
            }
        }
    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput())
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected string ReadToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return tokens.Dequeue();
        }

        protected long ReadLong() { return long.Parse(ReadToken()); }

        protected long[] ReadLongs()
        {
            var s = Read();
            if (s == "")
                return new long[0];
            var tokens = s.Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> s, string d) { return string.Join(d, s.ToArray()); }

        public static string JoinStrings(this IEnumerable<int> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
        public static string JoinStrings(this IEnumerable<long> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
    }
}


using System;
using System.Globalization;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Solve();
            p.Out(x);
        }

        object Solve()
        {
            checked
            {
                var n = ReadLong();
                if (n == 1)
                    return 1;
                var s = ReadLongs();
                var factors = new List<int>[100001];
                for (int i = 2; i < 100001; i++)
                {
                    factors[i] = new List<int>();
                }

                for (int i = 2; i <= s.Length; i++)
                {
                    if (factors[i].Count == 0)
                        for (int j = i; j < 100001; j+=i)
                        {
                            factors[j].Add(i);
                        }
                }
                var res = new int[100001];
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < factors[s[i]].Count; j++)
                        res[factors[s[i]][j]]++;
                }
                return Math.Max(res.Max(), 1);
            }
        }
    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput())
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected string ReadToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return tokens.Dequeue();
        }

        protected long ReadLong() { return long.Parse(ReadToken()); }

        protected long[] ReadLongs()
        {
            var s = Read();
            if (s == "")
                return new long[0];
            var tokens = s.Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> s, string d) { return string.Join(d, s.ToArray()); }

        public static string JoinStrings(this IEnumerable<int> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
        public static string JoinStrings(this IEnumerable<long> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
    }
}


using System;
using System.Globalization;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Solve();
            p.Out(x);
        }

        object Solve()
        {
            checked
            {
                var n = ReadLong();
                if (n == 1)
                    return 1;
                var s = ReadLongs();
                var factors = new List<int>[100001];
                for (int i = 2; i < 100001; i++)
                {
                    factors[i] = new List<int>();
                }

                for (int i = 2; i <= s.Length; i++)
                {
                    if (factors[i].Count == 0)
                        for (int j = i; j < 100001; j+=i)
                        {
                            factors[j].Add(j);
                        }
                }
                var res = new int[100001];
                for (int i = 2; i < 100001; i++)
                {
                    for (int j = 0; j < factors[i].Count; j++)
                        res[factors[i][j]]++;
                }
                return res.Max();
            }
        }
    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput())
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected string ReadToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return tokens.Dequeue();
        }

        protected long ReadLong() { return long.Parse(ReadToken()); }

        protected long[] ReadLongs()
        {
            var s = Read();
            if (s == "")
                return new long[0];
            var tokens = s.Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> s, string d) { return string.Join(d, s.ToArray()); }

        public static string JoinStrings(this IEnumerable<int> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
        public static string JoinStrings(this IEnumerable<long> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
    }
}


using System;
using System.Globalization;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Solve();
            p.Out(x);
        }

        object Solve()
        {
            checked
            {
                var n = ReadLong();
                if (n == 1)
                    return 1;
                var s = ReadLongs();
                var factors = new List<int>[100001];
                for (int i = 2; i < 100001; i++)
                {
                    factors[i] = new List<int>();
                }

                for (int i = 2; i <= s.Length; i++)
                {
                    if (factors[i].Count == 0)
                        for (int j = i; j < 100001; j+=i)
                        {
                            factors[j].Add(i);
                        }
                }
                var res = new int[100001];
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < factors[s[i]].Count; j++)
                        if (s[i] > 1)
                            res[factors[s[i]][j]]++;
                }
                return Math.Max(res.Max(), 1);
            }
        }
    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput())
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected string ReadToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return tokens.Dequeue();
        }

        protected long ReadLong() { return long.Parse(ReadToken()); }

        protected long[] ReadLongs()
        {
            var s = Read();
            if (s == "")
                return new long[0];
            var tokens = s.Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> s, string d) { return string.Join(d, s.ToArray()); }

        public static string JoinStrings(this IEnumerable<int> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
        public static string JoinStrings(this IEnumerable<long> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
    }
}


using System;
using System.Globalization;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Solve();
            p.Out(x);
        }

        object Solve()
        {
            checked
            {
                var n = ReadLong();
                if (n == 1)
                    return 1;
                var s = ReadLongs();
                var factors = new List<int>[100001];
                for (int i = 2; i < 100001; i++)
                {
                    factors[i] = new List<int>();
                }

                for (int i = 2; i < 100001; i++)
                {
                    if (factors[i].Count == 0)
                        for (int j = i; j < 100001; j+=i)
                        {
                            factors[j].Add(i);
                        }
                }
                var res = new int[100001];
                for (int i = 0; i < n; i++)
                {
                    if (s[i] > 1)
                        for (int j = 0; j < factors[s[i]].Count; j++)
                            res[factors[s[i]][j]]++;
                }
                return Math.Max(res.Max(), 1);
            }
        }
    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput())
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected string ReadToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return tokens.Dequeue();
        }

        protected long ReadLong() { return long.Parse(ReadToken()); }

        protected long[] ReadLongs()
        {
            var s = Read();
            if (s == "")
                return new long[0];
            var tokens = s.Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> s, string d) { return string.Join(d, s.ToArray()); }

        public static string JoinStrings(this IEnumerable<int> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
        public static string JoinStrings(this IEnumerable<long> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
    }
}


using System;
using System.Globalization;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Solve();
            p.Out(x);
        }

        object Solve()
        {
            checked
            {
                var n = ReadLong();
                if (n == 1)
                    return 1;
                var s = ReadLongs();
                var factors = new List<int>[100001];
                for (int i = 2; i < 100001; i++)
                {
                    factors[i] = new List<int>();
                }

                for (int i = 2; i <= s.Length; i++)
                {
                    if (factors[i].Count == 0)
                        for (int j = i; j < 100001; j+=i)
                        {
                            factors[j].Add(i);
                        }
                }
                var res = new int[100001];
                for (int i = 0; i < n; i++)
                {
                    if (s[i] > 1)
                        for (int j = 0; j < factors[s[i]].Count; j++)
                            res[factors[s[i]][j]]++;
                }
                return Math.Max(res.Max(), 1);
            }
        }
    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput())
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected string ReadToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return tokens.Dequeue();
        }

        protected long ReadLong() { return long.Parse(ReadToken()); }

        protected long[] ReadLongs()
        {
            var s = Read();
            if (s == "")
                return new long[0];
            var tokens = s.Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> s, string d) { return string.Join(d, s.ToArray()); }

        public static string JoinStrings(this IEnumerable<int> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
        public static string JoinStrings(this IEnumerable<long> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CF317
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var sr = new InputReader(Console.In);
            //var sr = new InputReader(new StreamReader("input.txt"));
            var task = new Task();
            using (var sw = Console.Out)
            //using (var sw = new StreamWriter("output.txt"))
            {
                task.Solve(sr, sw);
                //Console.ReadKey();
            }
        }
    }

    internal class Task
    {
        public void Solve(InputReader sr, TextWriter sw)
        {
            var n = sr.NextInt32();
            var array = sr.ReadArray(Int32.Parse);
            var primes = Primes(50000);
            var max = 0;
            for (var i = 0; i < primes.Count; i++) {
                var currCount = 0;
                for (var j = 0; j < n; j++) {
                    if (array[j] % primes[i] == 0) {
                        currCount++;
                    }
                }
                max = Math.Max(currCount, max);
            }

            sw.WriteLine(max);
        }

        private List<int> Primes(int n)
        {
            var notPrimes = new bool[n + 1];
            for (var i = 2; i < notPrimes.Length; i++) {
                if (!notPrimes[i]) {
                    for (var j = i * 2; j < notPrimes.Length; j += i) {
                        notPrimes[j] = true;
                    }
                }
            }
            var result = new List<int>();
            for (var i = 2; i < notPrimes.Length; i++) {
                if (!notPrimes[i]) {
                    result.Add(i);
                }
            }

            return result;
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(NextString());
    }

    public long NextInt64()
    {
        return Int64.Parse(NextString());
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();
            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CF317
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var sr = new InputReader(Console.In);
            //var sr = new InputReader(new StreamReader("input.txt"));
            var task = new Task();
            using (var sw = Console.Out)
            //using (var sw = new StreamWriter("output.txt"))
            {
                task.Solve(sr, sw);
                //Console.ReadKey();
            }
        }
    }

    internal class Task
    {
        public void Solve(InputReader sr, TextWriter sw)
        {
            var n = sr.NextInt32();
            var array = sr.ReadArray(Int32.Parse);
            var table = new int[100001];
            for (var i = 0; i < n; i++) {
                table[array[i]]++;
            }
            var result = Primes(100000, table);
            if (result == 1) {
                result = 0;
            }

            sw.WriteLine(result);
        }

        private int Primes(int n, int[] table)
        {
            var notPrimes = new bool[n + 1];
            var result = 0;
            for (var i = 2; i < notPrimes.Length; i++) {
                if (!notPrimes[i]) {
                    var curr = 0;
                    if (table[i] > 0) {
                        curr += table[i];
                    }
                    for (var j = i * 2; j < notPrimes.Length; j += i) {
                        curr += table[j];
                        notPrimes[j] = true;
                    }
                    result = Math.Max(result, curr);
                }
            }

            return result;
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(NextString());
    }

    public long NextInt64()
    {
        return Int64.Parse(NextString());
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();
            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CF317
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var sr = new InputReader(Console.In);
            //var sr = new InputReader(new StreamReader("input.txt"));
            var task = new Task();
            using (var sw = Console.Out)
            //using (var sw = new StreamWriter("output.txt"))
            {
                task.Solve(sr, sw);
                //Console.ReadKey();
            }
        }
    }

    internal class Task
    {
        public void Solve(InputReader sr, TextWriter sw)
        {
            var n = sr.NextInt32();
            var array = sr.ReadArray(Int32.Parse);
            var primes = Primes(50000);
            var max = 0;
            for (var i = 0; i < primes.Count; i++) {
                var currCount = 0;
                for (var j = 0; j < n; j++) {
                    if (array[j] % primes[i] == 0) {
                        currCount++;
                    }
                }
                max = Math.Max(currCount, max);
            }
            if (max == 1) {
                max = 0;
            }

            sw.WriteLine(max);
        }

        private List<int> Primes(int n)
        {
            var notPrimes = new bool[n + 1];
            for (var i = 2; i < notPrimes.Length; i++) {
                if (!notPrimes[i]) {
                    for (var j = i * 2; j < notPrimes.Length; j += i) {
                        notPrimes[j] = true;
                    }
                }
            }
            var result = new List<int>();
            for (var i = 2; i < notPrimes.Length; i++) {
                if (!notPrimes[i]) {
                    result.Add(i);
                }
            }

            return result;
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(NextString());
    }

    public long NextInt64()
    {
        return Int64.Parse(NextString());
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();
            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CF317
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var sr = new InputReader(Console.In);
            //var sr = new InputReader(new StreamReader("input.txt"));
            var task = new Task();
            using (var sw = Console.Out)
            //using (var sw = new StreamWriter("output.txt"))
            {
                task.Solve(sr, sw);
                //Console.ReadKey();
            }
        }
    }

    internal class Task
    {
        public void Solve(InputReader sr, TextWriter sw)
        {
            var n = sr.NextInt32();
            var array = sr.ReadArray(Int32.Parse);
            var table = new int[100001];
            for (var i = 0; i < n; i++) {
                table[array[i]]++;
            }
            var result = Primes(100000, table);

            sw.WriteLine(result);
        }

        private int Primes(int n, int[] table)
        {
            var notPrimes = new bool[n + 1];
            var result = 0;
            for (var i = 2; i < notPrimes.Length; i++) {
                if (!notPrimes[i]) {
                    var curr = 0;
                    if (table[i] > 0) {
                        curr += table[i];
                    }
                    for (var j = i * 2; j < notPrimes.Length; j += i) {
                        curr += table[j];
                        notPrimes[j] = true;
                    }
                    result = Math.Max(result, curr);
                }
            }

            return result;
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(NextString());
    }

    public long NextInt64()
    {
        return Int64.Parse(NextString());
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();
            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CF317
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var sr = new InputReader(Console.In);
            //var sr = new InputReader(new StreamReader("input.txt"));
            var task = new Task();
            using (var sw = Console.Out)
            //using (var sw = new StreamWriter("output.txt"))
            {
                task.Solve(sr, sw);
                //Console.ReadKey();
            }
        }
    }

    internal class Task
    {
        public void Solve(InputReader sr, TextWriter sw)
        {
            var n = sr.NextInt32();
            var array = sr.ReadArray(Int32.Parse);
            var table = new int[100001];
            for (var i = 0; i < n; i++) {
                table[array[i]]++;
            }
            var result = Primes(100000, table);
            if (result == 0) {
                result = 1;
            }

            sw.WriteLine(result);
        }

        private int Primes(int n, int[] table)
        {
            var notPrimes = new bool[n + 1];
            var result = 0;
            for (var i = 2; i < notPrimes.Length; i++) {
                if (!notPrimes[i]) {
                    var curr = 0;
                    if (table[i] > 0) {
                        curr += table[i];
                    }
                    for (var j = i * 2; j < notPrimes.Length; j += i) {
                        curr += table[j];
                        notPrimes[j] = true;
                    }
                    result = Math.Max(result, curr);
                }
            }

            return result;
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(NextString());
    }

    public long NextInt64()
    {
        return Int64.Parse(NextString());
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();
            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n=int.Parse(Console.ReadLine());
            string[] jopa = Console.ReadLine().Split();
            int[] array = new int[100001];
            for(int i=0;i<n;i++)
            array[int.Parse(jopa[i])]++;
            int result = 0;
            for(int i=2;i<=array.Length-1;i++)
            {
                int temp = 0;
                for(int j=0;j<=array.Length-1;j+=i)
                {
                    temp += array[j];
                }
                result = Math.Max(result, temp);
            }
            if (result == 0) result = 1;
            Console.WriteLine(result);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n=int.Parse(Console.ReadLine());
            string[] jopa = Console.ReadLine().Split();
            int[] array = new int[100001];
            for(int i=0;i<n;i++)
            array[int.Parse(jopa[i])]++;
            int result = 0;
            for(int i=2;i<=array.Length-1;i++)
            {
                int temp = 0;
                for(int j=0;j<array.Length-1;j+=i)
                {
                    temp += array[j];
                }
                result = Math.Max(result, temp);
            }
            if (result == 0) result = 1;
            Console.WriteLine(result);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1A
{
  class ProgramBBB
  {
    static void Main(string[] args)
    {

      int n = Convert.ToInt32(Console.ReadLine());
      string[] tk = Console.ReadLine().Split(' ');
      List<int> L = new List<int>();
      for (int i = 0; i < n; i++)
        L.Add(Convert.ToInt32(tk[i]));

      SortedSet<int> Divs = new SortedSet<int>();

      int x = (int)(Math.Truncate(Math.Sqrt(100000)) + 1);

      for (int i = 2; i <= 100000; i++)
      {
        bool prime = true;
        for (int j = 2; j <= x; j++)
        {
          if ((i>j)&&(i % j) == 0) { prime = false; break; }
        }
        if (prime) Divs.Add(i);
      }

      int maxr = 0;

      foreach (int div in Divs){
        int r = 0;
        foreach(int num in L){
          if (num >= div && num % div == 0)
            r++;
        }
        maxr = Math.Max(r, maxr);
      }

      Console.WriteLine(maxr);
    }

  }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1A
{
  class ProgramBBB
  {
    static void Main(string[] args)
    {

      int n = Convert.ToInt32(Console.ReadLine());
      string[] tk = Console.ReadLine().Split(' ');

      int[] M = new int[100001];
      for (int i = 0; i < 100001; i++) M[i] = 0;

      for (int i = 0; i < n; i++)
        M[Convert.ToInt32(tk[i])]++;

      int bestr = 0;
      for (int i = 2; i <= (int)(Math.Sqrt(100000))+1; i++){
        int r = 0;
        for (int j = 0; j <= 100000; j = j + i)
        {
          r = r + M[j];
        }
        bestr = Math.Max(bestr, r);
      }

      if (bestr == 0) bestr = 1;
      Console.WriteLine(bestr);
    }

  }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1A
{
  class ProgramBBB
  {
    static void Main(string[] args)
    {

      int n = Convert.ToInt32(Console.ReadLine());
      string[] tk = Console.ReadLine().Split(' ');

      int[] M = new int[100001];
      for (int i = 0; i < 100001; i++) M[i] = 0;

      for (int i = 0; i < n; i++)
        M[Convert.ToInt32(tk[i])]++;

      int bestr = 0;
      for (int i = 2; i <= (int)(Math.Sqrt(100000))+1; i++){
        int r = 0;
        for (int j = 0; j <= 100000; j = j + i)
        {
          r = r + M[j];
        }
        bestr = Math.Max(bestr, r);
      }

      Console.WriteLine(bestr);
    }

  }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1A
{
  class ProgramBBB
  {
    static void Main(string[] args)
    {

      int n = Convert.ToInt32(Console.ReadLine());
      string[] tk = Console.ReadLine().Split(' ');
      List<int> L = new List<int>();
      for (int i = 0; i < n; i++)
        L.Add(Convert.ToInt32(tk[i]));

      L.Sort();

      SortedSet<int> Divs = new SortedSet<int>();

      int x = (int)(Math.Truncate(Math.Sqrt(100000)) + 1);

      for (int i = 2; i <= 100000; i++)
      {
        bool prime = true;
        for (int j = 2; j <= x; j++)
        {
          if ((i>j)&&(i % j) == 0) { prime = false; break; }
        }
        if (prime) Divs.Add(i);
      }

      int maxr = 0;

      foreach (int div in Divs){
        int r = 0;
        foreach(int num in L){
          if (num >= div && num % div == 0)
            r++;
        }
        while (L[0] <= div) { L.Remove(0); if (L.Count == 0) break; }
          maxr = Math.Max(r, maxr);
      }

      Console.WriteLine(maxr);
    }

  }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1A
{
  class ProgramBBB
  {
    static void Main(string[] args)
    {

      int n = Convert.ToInt32(Console.ReadLine());
      string[] tk = Console.ReadLine().Split(' ');
      List<int> L = new List<int>();
      for (int i = 0; i < n; i++)
        L.Add(Convert.ToInt32(tk[i]));

      L.Sort();

      SortedSet<int> Divs = new SortedSet<int>();

      int x = (int)(Math.Truncate(Math.Sqrt(100000)) + 1);

      for (int i = 2; i <= 100000; i++)
      {
        bool prime = true;
        for (int j = 2; j <= x; j++)
        {
          if ((i>j)&&(i % j) == 0) { prime = false; break; }
        }
        if (prime) Divs.Add(i);
      }

      int maxr = 0;

      foreach (int div in Divs){
        int r = 0;
        foreach(int num in L){
          if (num >= div && num % div == 0)
            r++;
        }
        while (L[0] <= div) { L.RemoveAt(0); if (L.Count == 0) break; }
        maxr = Math.Max(r, maxr);
        if (L.Count == 0) break;
      }

      Console.WriteLine(maxr);
    }

  }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1A
{
  class ProgramBBB
  {
    static void Main(string[] args)
    {

      int n = Convert.ToInt32(Console.ReadLine());
      string[] tk = Console.ReadLine().Split(' ');

      int[] M = new int[100001];
      for (int i = 0; i < 100001; i++) M[i] = 0;

      for (int i = 0; i < n; i++)
        M[Convert.ToInt32(tk[i])]++;

      int bestr = 0;
      for (int i = 2; i <= 100000; i++)
      {
        int r = 0;
        for (int j = 0; j <= 100000; j = j + i)
        {
          r = r + M[j];
        }
        bestr = Math.Max(bestr, r);
      }

      if (bestr == 0) bestr = 1;
      Console.WriteLine(bestr);
    }

  }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BashsBigDay
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] s = Console.ReadLine().Split();
            int[] a = new int[n];
            int[] res = new int[100000];

            if (n == 1)
            {
                Console.WriteLine(1);
                return;
            }

            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(s[i]);
            }

            for (int i = 0; i < n; i++)
            {
                if (a[i] == 2)
                {
                    res[2]++;
                    continue;
                }
                for (int j = 2; j <= a[i]; j++)
                {
                    if (a[i] % j == 0)
                    {
                        res[j]++;
                        while (a[i] % j == 0)
                            a[i] /= j;
                    }
                }
            }
            int max = 0;
            for (int i = 0; i < 100000; i++)
            {
                if (res[i] > max)
                    max = res[i];
            }
            Console.WriteLine(max);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BashsBigDay
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] s = Console.ReadLine().Split();
            int[] a = new int[n];
            int[] res = new int[100000];

            if (n == 1)
            {
                Console.WriteLine(1);
                return;
            }

            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(s[i]);
            }

            for (int i = 0; i < n; i++)
            {
                if (a[i] == 2)
                {
                    res[2]++;
                    continue;
                }
                int x = a[i];
                for (int j = 2; j <= a[i]; j++)
                {
                    if (x % j == 0)
                    {
                        res[j]++;
                        while (x % j == 0)
                            x /= j;
                    }
                }
            }
            int max = 0;
            for (int i = 0; i < 100000; i++)
            {
                if (res[i] > max)
                    max = res[i];
            }
            Console.WriteLine(max);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BashsBigDay
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] s = Console.ReadLine().Split();
            int[] a = new int[n];
            int[] res = new int[100000];

            if (n == 1)
            {
                Console.WriteLine(1);
                return;
            }

            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(s[i]);
            }

            for (int i = 0; i < n; i++)
            {
                if (a[i] == 2)
                {
                    res[2]++;
                    continue;
                }
                int x = a[i];
                for (int j = 2; j <= a[i]; j++)
                {
                    if (x % j == 0)
                    {
                        res[j]++;
                        while (x % j == 0)
                            x /= j;
                    }
                }
            }
            foreach (int item in res)
            {
                if(item != 0)
                    Console.WriteLine(item);
            }

            int max = 0;
            for (int i = 0; i < 100000; i++)
            {
                if (res[i] > max)
                    max = res[i];
            }
            Console.WriteLine(max);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BashsBigDay
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] s = Console.ReadLine().Split();
            int[] a = new int[n];
            int[] res = new int[100000];

            if (n == 1)
            {
                Console.WriteLine(1);
                return;
            }

            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(s[i]);
            }

            for (int i = 0; i < n; i++)
            {
                if (a[i] == 2)
                {
                    res[2]++;
                    continue;
                }
                int x = a[i];
                for (int j = 2; j * j <= a[i]; j++)
                {
                    if (x % j == 0)
                    {
                        res[j]++;
                        while (x % j == 0)
                            x /= j;
                    }
                }
            }
            int max = 0;
            for (int i = 0; i < 100000; i++)
            {
                if (res[i] > max)
                    max = res[i];
            }
            Console.WriteLine(max);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BashsBigDay
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] s = Console.ReadLine().Split();
            int[] a = new int[n];
            int[] res = new int[100000];

            if (n == 1)
            {
                Console.WriteLine(1);
                return;
            }

            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(s[i]);
            }

            Array.Sort(a);
            if (a[n - 1] == 1)
            {
                Console.WriteLine(1);
                return;
            }

            for (int i = 0; i < n; i++)
            {
                int k = 1;
                while (i != n -1 && a[i] == a[i + 1])
                {
                    k++;
                    i++;
                    if (i == n - 1)
                        break;
                }
                for (int j = 2; j <= a[i]; j++)
                {
                    if (a[i] % j == 0)
                    {
                        res[j] += k;
                        while (a[i] % j == 0)
                            a[i] /= j;
                    }
                }
            }
            int max = 0;
            for (int i = 0; i < 100000; i++)
            {
                if (res[i] > max)
                    max = res[i];
            }
            Console.WriteLine(max);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BashsBigDay
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] s = Console.ReadLine().Split();
            int[] a = new int[n];
            int[] res = new int[100000];
            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(s[i]);
            }

            for (int i = 0; i < n; i++)
            {
                if (a[i] == 2)
                {
                    res[2]++;
                    continue;
                }
                int x = a[i];
                for (int j = 2; j * j <= a[i]; j++)
                {
                    if (x % j == 0)
                    {
                        res[j]++;
                        while (x % j == 0)
                            x /= j;
                    }
                }
            }
            int max = 0;
            for (int i = 0; i < 100000; i++)
            {
                if (res[i] > max)
                    max = res[i];
            }
            Console.WriteLine(max);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bash_sBigDay
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] s = Console.ReadLine().Split();
            int[] a = new int[n];
            int max = 0;
            int res = 0;
            int c;
            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(s[i]);
                if (a[i] > max)
                    max = a[i];
            }
            List<int> primes = PrimeNumbers(max);
            primes.Sort();

            for (int i = 0; i < primes.Count; i++)
            {
                c = 0;
                for (int j = 0; j < n; j++)
                {
                    if (primes[i] > a[j])
                        break;
                    if (a[j] % primes[i] == 0)
                        c++;
                }
                if (c > res)
                    res = c;
            }
            Console.WriteLine(res);
        }
        static List<int> PrimeNumbers(int n)
        {

            List<int> p = new List<int>();
            p.Add(2);
            for (int i = 3; i < n; i += 2)
            {
                bool t = true;
                for (int j = 2; j * j <= i; j++)
                {
                    if (i % j == 0)
                    {
                        t = false;
                        break;
                    }
                }
                if (t)
                    p.Add(i);
            }
            return p;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BashsBigDay
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] s = Console.ReadLine().Split();
            int[] a = new int[n];
            int[] res = new int[100000];

            if (n == 1)
            {
                Console.WriteLine(1);
                return;
            }

            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(s[i]);
            }

            Array.Sort(a);

            for (int i = 0; i < n; i++)
            {
                int k = 1;
                while (i != n -1 && a[i] == a[i + 1])
                {
                    k++;
                    i++;
                    if (i == n - 1)
                        break;
                }
                for (int j = 2; j <= a[i]; j++)
                {
                    if (a[i] % j == 0)
                    {
                        res[j] += k;
                        while (a[i] % j == 0)
                            a[i] /= j;
                    }
                }
            }
            int max = 0;
            for (int i = 0; i < 100000; i++)
            {
                if (res[i] > max)
                    max = res[i];
            }
            Console.WriteLine(max);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication252
{
    class Program
    {

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            List<int> l = new List<int>();
            string[] s = Console.ReadLine().Split();
            int k = 0;
            for (int i = 2; i <= 350; i++)
            {
                k = 0;
                for (int e = 0; e < n; e++)
                {
                    if (int.Parse(s[e]) % i == 0)
                    {
                        k++;
                    }
                }
                l.Add(k);
            }
            int max = -1;
            for (int i = 0; i < l.Count; i++)
            {
                if (l[i] > max)
                {
                    max = l[i];
                }
            }
            Console.WriteLine(max);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication252
{
    class Program
    {

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            List<int> p = new List<int>();
            bool[] b = new bool[1000];
            for (int i = 2; i < b.Length; i++)
            {
                if (!b[i])
                {
                    for (int e = i + i; e < b.Length; e += i)
                    {
                        b[e] = true;
                    }
                }
            }
            for (int i = 2; i < b.Length; i++)
            {
                if (!b[i])
                {
                    p.Add(i);
                }

            }

           string[] s = Console.ReadLine().Split();
            int k = 0;
            int max = 1;
            for (int i = 0; i <p.Count; i++)
            {
                k = 0;
                int x = p[i];
                for (int e = 0; e < n; e++)
                {
                    if (int.Parse(s[e]) % x == 0)
                    {
                        k++;
                    }
                }
                if (k >= max)
                {
                    max = k;
                }
            }

            Console.WriteLine(max);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

class PairVariable : IComparable<PairVariable>
{
    public int a, b;
    public int c;
    public PairVariable()
    {
        a = b = 0;
        c = 0;
    }
    public PairVariable(string s)
    {
        string[] q = s.Split();
        a = int.Parse(q[0]);
        b = int.Parse(q[1]);
        c = 0;

    }

    public PairVariable(int a, int b, int c)
    {
        this.a = a;
        this.b = b;
        this.c = c;

    }

    public int CompareTo(PairVariable other)
    {
        return this.c.CompareTo(other.c);
    }
}

namespace ConsoleApplication3
{
    class Program
    {
        static int get(int ind, int tl, int tr, int pos)
        {
            if (tl == tr)
                return t[ind];
            int tm = (tl + tr) / 2;
            if (pos <= tm)
                return t[ind] + get(ind * 2 + 1, tl, tm, pos);
            else
                return t[ind] + get(ind * 2 + 2, tm + 1, tr, pos);
        }

        static int[] t;
        static void update(int ind, int tl, int tr, int l, int r)
        {
            if (l > r)
            {
                return;
            }
            if (r == tr && l == tl)
            {
                t[ind]++;
                return;
            }
            else
            {
                int tm = (tr + tl) / 2;
                update(ind * 2 + 1, tl, tm, l, Math.Min(r, tm));
                update(ind * 2 + 2, tm + 1, tr, Math.Max(tm + 1, l), r);
            }

        }
        static bool isPrime(int n)
        {
            for (int i = 2; i <= Math.Sqrt(n); i++)
            {
                if (n % i == 0)
                {
                    return false;
                }
            }
            return true;
        }
        static int gcd(int a, int b)
        {
            if (b == 0)
            {
                return a;
            }
            else
            {
                return gcd(b, a % b);
            }
        }

        static void Main(string[] args)
        {
            string[] ss = Console.ReadLine().Split();

            int n = int.Parse(ss[0]);
            string[] s = Console.ReadLine().Split();
            int[] m = new int[n];
            for (int i = 0; i < n; i++)
            {
                m[i] = int.Parse(s[i]);
            }
            int ans = 0;
            Dictionary<int, int> cnt = new Dictionary<int, int>();
            for (int i = 2; i <= 100000; i++)
            {
                cnt.Add(i, 0);
            }
            for (int i = 0; i < n; i++)
            {

                int x = m[i];
                cnt[x]++;
                for (int e = 2; e <= Math.Sqrt(x); e++)
                {

                    if (x % e == 0)
                    {
                        cnt[e]++;
                        if (x / e != e)
                        {
                            cnt[x / e]++;
                        }
                    }
                }
            }

            Console.WriteLine(cnt.Values.Max());

        }
    }
}