n = int(input()) a, b, c = map(int, input().split()) s_set = set() if a == 1 or b == 1 or c == 1: print(n) exit(1) for i in range(a, n + 1, a): s_set.add(i) for i in range(b, n + 1, b): s_set.add(i) for i in range(c, n + 1, c): s_set.add(i) print(len(s_set))