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){ new Main().run2(); } private void run(){ 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).parallel().filter(f -> f % a == 0 || f % b == 0 || f % c == 0).toArray().length); } private void run2(){ 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]); Count count = new Count(); IntStream.range(1,n+1).parallel().forEach(e->{ if(e % a == 0 || e % b == 0 || e % c == 0){ synchronized (count){ count.count++; } } }); System.out.println(count.count); } class Count{ public int count=0; } }