use strict; use warnings; my $range = <>; my %table; for my $i (split ' ', <>) { for (my $j = $i; $j <= $range; $j += $i){ if(!defined($table{$j})){ $table{$j} = 1 } } } print scalar(keys %table);