$n = fgets(STDIN); $etos = []; for ($i = 0; $i < $n; $i++) { $etos[] = trim(fgets(STDIN)); } $cnt = count($etos); $max = max(array_count_values($etos)); if (($cnt + 1) / 2 <= $max) { echo "YES", PHP_EOL; } else { echo "NO", PHP_EOL; }