import java.util.Scanner; import java.util.stream.IntStream; /** * Created by nullzine on 2017/01/19. */ public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.nextLine()); String[] strs = sc.nextLine().split(" "); int a=Integer.parseInt(strs[0]),b=Integer.parseInt(strs[1]),c=Integer.parseInt(strs[2]); System.out.println(IntStream.range(1,n+1).filter(f->f%a==0||f%b==0||f%c==0).toArray().length); } }