#a, b, cがすべて異なるとき: 3つの集合の和集合
#n(AorBorC) = n(A)+n(B)+n(C)-n(A&B)-n(B&C)-n(C&A)+n(A&B&C)
#a, b, cのうちちょうど2つが等しいとき: 2つの集合の和集合
#a, b, cのどれもが等しいとき: n(a)
######## !!注意!! n(A&B):AとBの「最小公倍数」の倍数の数

from fractions import gcd

def lcm(numbers):
    return reduce(lambda x, y: (x*y)/gcd(x,y), numbers, 1)
    
N = input()
li = map(int, raw_input().split())
li_uniq = []    #重複を消す
for i in li:
    if not i in li_uniq:
        li_uniq.append(i)

if len(li_uniq) == 3:
    a = li_uniq[0]
    b = li_uniq[1]
    c = li_uniq[2]
    na = N/a
    nb = N/b
    nc = N/c
    nab = N/lcm([a, b])
    nbc = N/lcm([b, c])
    nca = N/lcm([c, a])
    nabc = N/lcm([a, b, c])
    print na+nb+nc-nab-nbc-nca+nabc
    #print na, nb, nc, nab, nbc, nca, nabc
elif len(li_uniq) == 2:
    a = li_uniq[0]
    b = li_uniq[1]
    na = N/a
    nb = N/b
    nab = N/lcm([a,b])
    print na+nb-nab
else:
    a = li_uniq[0]
    na = N/a
    print na