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