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