use strict; my $N = ; my @list; my $str; for (my $i = 0; $i < $N; $i++) { $str = ; push(@list, $str); } @list = sort {$a <=> $b} @list; my $cnt = 0; my $cnt_max = 0; my $res = ""; foreach my $i(@list) { if($i ne $res) { $cnt = 0; } $cnt++; $res = $i; if($cnt > $cnt_max) { $cnt_max = $cnt; } } if($cnt_max >= int(@list / 2) + 1) { print "NO\n"; } else { print "YES\n"; }