# 包除原理、ビット全探索 # Algo X Math ID068 N = int(input()) abc = list(map(int, input().split())) K = 3 from math import gcd ans = 0 for bit in range(1<>shift & 1 == 1: count += 1 LCM = LCM*abc[shift]//gcd(LCM, abc[shift]) if count%2 == 1: ans += N//LCM else: ans -= N//LCM #print(bin(bit), count, LCM, N//LCM, ans) print(ans)