N = raw_input() a,b,c = map(int,raw_input().split()) cnt = 0 aa = i % a bb = i % b cc = i % c for i in range(1,N): if aa == 0 or bb == 0 or cc == 0: cnt = cnt + 1 print cnt