n = int(input()) a,b,c = map(int,input().split()) n += 1 ans = list(range(a,n,a)) ans += list(range(b,n,b)) ans += list(range(c,n,c)) print(len(set(ans)))