<?php
$count = trim(fgets(STDIN));
$timetable = explode(' ', trim(fgets(STDIN)));
$min = $timetable[0];
$n = 1;
$m = 0;
for ($i = 1; $i <= $count; $i++) {
    if ($time[$i]) {

    }
}
foreach ($timetable as $number=>$time) {
    if ($time <= $min) {
        $min = $time;
        $n = $number + 1;
    }
}
foreach ($timetable as $number=>$time) {
    if ($min == $time) {
           $m++;
    }
}
if ($m > 1) {
    echo 'Still Rozdil';
} else {
    echo $n;
}
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$a = explode(' ',fgets($fh));
	for($i = 0;$i<$n;$i++){
		$a[$i] = intval($a[$i]);
	}
	asort($a);
 	$minval = intval($a[key($a)]);
 	$cnt = 0;
	for($i = 0;$i<$n;$i++){
		if (intval($a[$i]) == intval($minval)){
			$cnt++;
		}
	}
	if ($cnt >= 2) print "Still Rozdil"; else print key($a) + 1;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$a = explode(' ',fgets($fh));
	$flag = false;
	if (intval($a[key($a)]) == 658007){
		$flag = true;
	}

	$minval = 1<<30;
	$res = 0;
	for($i = 0;$i<$n;$i++){
		if ($minval > intval($a[$i])){
			$res = $i + 1;
			$minval = intval($a[$i]);
		}
	}
	$cnt = 0;
	for($i = 0;$i<$n;$i++){
		if (intval($a[$i]) == intval($minval)){
			$cnt++;
		}
	}
	if (intval($cnt) >= intval(2)) print "Still Rozdil"; else print $res;
?>

<?php
$n = trim(fgets(STDIN));

$c = explode(' ',trim(fgets(STDIN)));

$min = 1000000000 + 1;
$t = array();
for($i=0;$i<$n;$i++){
 if($c[$i] == $min) $t[] = $i + 1;
 if($c[$i] < $min){$min = $c[$i]; $t = array(0 => $i + 1);}
}

if(count($t) > 1) print 'Still Rozdil'; else print $t[0];
?>

<?php
fscanf(STDIN, "%d\n", $total);

$numbers = explode(' ', fgets(STDIN));
$result = 1000000000;
$all = [];
foreach($numbers as $k => $number) {
	$number = intval($number);
	if (!isset($all[$number])) {
		$all[$number] = [];
	}
	$all[$number][] = $k + 1;
	$result = min($result, $number);
}
if (count($all[$result]) == 1) {
	echo $all[$result][0];
} else {
	echo "Still Rozdil";
}

<?php
 $l= trim(fgets(STDIN));
 $tm=explode(' ',trim(fgets(STDIN)));
 $min=$tm[0];$w=1;$q=0;
 foreach ($tm as $key=>$value)
   {
        if ($min>$value)
          { $min=$value; $w=$key+1;};
    };
  foreach ($tm as $value)
   {   if ($value==$min) {$q++;};
   };
if ($q==1) {print ($w);} else {print ("Still Rozdil");};
?>

<?php
$stdin = fopen("php://stdin", "r");
$stdout = fopen("php://stdout", "w");
$n = fgets($stdin);
$arr = explode(" ",fgets($stdin));
fclose($stdin);
$min = 0x3f3f3f3f;
$cur = 0;
$i = 0;
foreach($arr as $t){
	$t = intval($t);
	++$i;
	if($t < $min){
		$min = $t;
		$cur = $i;
		continue;
	}
	if($t == $min){
		$cur = 0;
		continue;
	}
}
fputs($stdout,$cur == 0?"Still Rozdil":$cur);
?>

<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
array_unshift($b, " ");
unset($b[0]);
asort($b);
$c = $b;
sort($c);
$d = array_keys($b);
if($c[0] == $c[1])
{
    print "Still Rozdil";
}
else
{
    print $d[0];
}
?>

<?php
fscanf(STDIN, "%d\n", $total);

$numbers = explode(' ', fgets(STDIN));
$result = 1000000000;
$all = [];
foreach($numbers as $k => $number) {
	if (!isset($all[$number])) {
		$all[$number] = [];
	}
	$all[$number][] = $k + 1;
	$result = min($result, $number);
}
if (count($all[$result]) == 1) {
	echo $all[$result][0];
} else {
	echo 'Still Rozdil';
}

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$a = explode(' ',fgets($fh));
	asort($a);
 	$minval = $a[key($a)];
 	$cnt = 0;
	for($i = 0;$i<$n;$i++){
		if ($a[$i] == $minval){
			$cnt++;
		}
	}
	if ($cnt >= 2) print "Still Rozdil"; else print key($a) + 1;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$a = explode(' ',fgets($fh));
	asort($a);
 	$minval = intval($a[key($a)]);
 	$cnt = 0;
	for($i = 0;$i<$n;$i++){
		if (intval($a[$i]) == intval($minval)){
			$cnt++;
		}
	}
	if ($cnt >= 2) print "Still Rozdil"; else print key($a) + 1;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$a = explode(' ',fgets($fh));
	asort($a);
 	$minval = intval($a[key($a)]);
 	$cnt = 0;
	for($i = 0;$i<$n;$i++){
		if (intval($a[$i]) == intval($minval)){
			$cnt++;
		}
	}
	if (intval($cnt) >= intval(2)) print "Still Rozdil"; else print intval(key($a)) + 1;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$a = explode(' ',fgets($fh));
	$flag = false;
	if (intval($a[key($a)]) == 658007){
		$flag = true;
	}
	asort($a);
	if ($flag) print_r($a);
 	$minval = intval($a[key($a)]);
 	$cnt = 0;
	for($i = 0;$i<$n;$i++){
		if (intval($a[$i]) == intval($minval)){
			$cnt++;
		}
	}
	if (intval($cnt) >= intval(2)) print "Still Rozdil"; else print intval(key($a)) + 1;
?>

<?php
	$filename = "php://stdin";
	$fh = fopen($filename,'r');
	$n = intval(fgets($fh));
	$a = explode(' ',fgets($fh));
	$flag = false;
	if (intval($a[key($a)]) == 658007){
		$flag = true;
	}

	$minval = 1<<30;
	$res = 0;
	for($i = 0;$i<$n;$i++){
		if ($minval > $a[$i]){
			$res = $i + 1;
			$minval = $a[$i];
		}
	}
	$cnt = 0;
	for($i = 0;$i<$n;$i++){
		if (intval($a[$i]) == intval($minval)){
			$cnt++;
		}
	}
	if (intval($cnt) >= intval(2)) print "Still Rozdil"; else print $res;
?>


  <?php
  $t = trim(fgets(STDIN));
   for($w=0; $w<$t; $w++) {

     $n =   trim(fgets(STDIN));
     $s =  explode(' ', trim(fgets(STDIN)));

     $count = 0;
     for ($i = 0; $i < $n; $i++) {
         if($s[$i] != 2) {
             $count++;
         }
     }

     echo $count . "\n";

}

<?php
$t = trim(fgets(STDIN));

for($i=0;$i<$t;$i++){
    $n = trim(fgets(STDIN));
    $up = 0;
    $arr = explode(' ',trim(fgets(STDIN)));
    for ($j = 0; $j < $n; $j++) {
        if($arr[$j] != 2) {
            $up++;
        }
    }
    echo $up . "\n";
}

?>

<?php
class IO {
    public static function arr($sDelimeter = ' ') { return explode($sDelimeter, trim(fgets(STDIN))); }
    public static function str() { return trim(fgets(STDIN)); }
    public static function yes() { echo 'YES' . PHP_EOL; }
    public static function no() { echo 'NO' . PHP_EOL; }
    public static function line($sLine) { echo $sLine . PHP_EOL; }
    public static function lcm($x, $y) {
        $p = $x;
        $q = $y;
        while ($x != $y)
        {
            if ($x > $y)
                $x = $x - $y;
            else
                $y = $y - $x;
        }
        return ($p*$q)/$x;
    }
    public static function gcd($a, $b) {
        return ($a % $b) ? self::gcd($b,$a % $b) : $b;
    }
}

//$iQueryCount = 1;
$iQueryCount = IO::str();

while($iQueryCount > 0) {
    $iQueryCount--;
    solve();
}
function solve() {
    $n = IO::str();
    $a = IO::arr();
    $c = 0;
    foreach ($a as $v) {
        if ($v != 2) {
            $c++;
        }
    }

    IO::line($c);

}

?>

<?php

$t = trim(fgets(STDIN));

while ($t--) {
//    $score = array();
    $n = trim(fgets(STDIN));
    $us = explode(' ', trim(fgets(STDIN)));

    $score[1] = 0;
    $score[2] = 0;
    $score[3] = 0;

    for ($i = 0; $i < $n ; $i++) {
        $score[$us[$i]]++;
    }

    $res[] = $score[1] + $score[3];
}

foreach ($res as $r) {
    echo $r . "\n";
}

<?php
$fileName = 'php://stdin';
$file = fopen($fileName, "r");

$t = trim(fgets($file));

for ($i = 0; $i < $t; $i++) {
  $n = trim(fgets($file));
  $r = explode(" ", trim(fgets($file)));

  $l = 0; $d = 0;
  for ($j = 0; $j < $n; $j++) {
    if ($r[$j] == 3) { $l++; }

    if ($r[$j] == 1) { $l++; }
  }
  echo $l.PHP_EOL;
}

?>


<?php
$n = (int)fgets(STDIN);
$s = trim(fgets(STDIN));
$t = trim(fgets(STDIN));

$swapped = false;

$lettersAt = array();

for ($i = 0; $i < $n; $i++) {
  if ($s[$i] == $t[$i]) {
    continue;
  }
  if (isset($lettersAt[$s[$i] . $t[$i]])) {
    $j = $lettersAt[$s[$i] . $t[$i]];
    $tmp = $s[$i];
    $s[$i] = $s[$j];
    $s[$j] = $tmp;
    $swapped = ($j + 1) . " " . ($i + 1) . "\n";
    break;
  } else {
    $lettersAt[$t[$i] . $s[$i]] = $i;
  }
}

if ($swapped === false) {
  $lettersAtS = $lettersAtT = array();
  for ($i = 0; $i < $n; $i++) {
    if ($s[$i] == $t[$i]) {
      continue;
    }
    if (isset($lettersAtS[$t[$i]])) {
      $j = $lettersAtS[$t[$i]];
      $tmp = $s[$i];
      $s[$i] = $s[$j];
      $s[$j] = $tmp;
      $swapped = ($j + 1) . " " . ($i + 1) . "\n";
      break;
    } elseif (isset($lettersAtT[$s[$i]])) {
      $j = $lettersAtT[$s[$i]];
      $tmp = $s[$i];
      $s[$i] = $s[$j];
      $s[$j] = $tmp;
      $swapped = ($j + 1) . " " . ($i + 1) . "\n";
      break;
    } else {
      $lettersAtS[$s[$i]] = $i;
      $lettersAtT[$t[$i]] = $i;
    }
  }
}

if (! $swapped) {
  $swapped = "-1 -1\n";
}

$hamming = 0;
for ($i = 0; $i < $n; $i++) {
  if ($s[$i] != $t[$i]) {
    $hamming++;
  }
}

echo "$hamming\n$swapped";


<?php

###### IO ######
error_reporting(E_ALL);
error_reporting(0);

function readString($f) {
	$r = array(
		"\r" => '',
		"\n" => '',
	);
	return strtr(fgets($f), $r);
}

function readNumString($f) {
	return trim(fgets($f));
}

function stringToArray($str) {
	return str_split($str);
}

function readNum($f, $is_int = false) {
	$v = readNumString($f);
	return $is_int ? intval($v) : floatval($v);
}

function readStringExplode($f, $delimiter = ' ') {
	$v = readNumString($f);
	if ($delimiter == '') {
		$return = stringToArray($v);
	} else {
		$return = explode($delimiter, $v);
	}
	$callf = 'trim';
	return array_map($callf, $return);
}

function readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {
	$v = readNumString($f);
	if ($delimiter == '') {
		$return = stringToArray($v);
	} else {
		$return = explode($delimiter, $v);
	}
	$callf = $is_int ? 'intval' : 'floatval';
	return array_map($callf, $return);
}

###### /IO ######

function getAnswer($is_test = false, $f = false) {
	if ($is_test === false) {
		$f = STDIN;
	}
	/* begin body */
	$n = readNum($f);
	$str = readString($f);
	$chars = str_split($str);
	$charsCount = array();
	$maxCount = 26;
	$changes = 0;
	foreach ($chars as $s) {
		if (!empty($charsCount[$s])) {
			$changes++;
		} else {
			$charsCount[$s] = true;
		}
	}
	if (count($charsCount) + $changes > $maxCount) {
		echo -1;
	} else {
		echo $changes;
	}
	/* / end body */
}

if (empty($is_test))
	getAnswer();


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$d = array();
for($x = 1; $x <= $a; $x++)
{
    $c = explode(" ", trim(fgets(STDIN)));
    for($y = 1; $y < count($c); $y++)
    {
        if($b > $c[$y])
        {
            array_push($d, $x);
            break;
        }
    }
}
print count($d) . "\n";
print implode(" ", $d);
?>

<?php
function getIntList($number = 1){
    $chunk = "%d ";
    $format = str_repeat($chunk, $number);
    $result = fscanf(STDIN, $format);
    return $result;
}

list($seller, $money) = getIntList(2);
$goodSeller = array();
$goods = array();
for ($i = 1; $i <= $seller; $i++) {
    $sellerData = explode(' ', trim(fgets(STDIN)));
    for ($j = 1; $j <= $sellerData[0]; $j++) {
        if ($sellerData[$j] < $money) {
            $goodSeller[] = $i;
            break;
        }
    }
}
$c = count($goodSeller);
if ($c > 0) {
    echo $c . PHP_EOL;
    echo implode(' ', $goodSeller);
} else {
    echo 0;
}
echo PHP_EOL;

?>

<?php
function getIntList($number = 1){
    $chunk = "%d ";
    $format = str_repeat($chunk, $number);
    $result = fscanf(STDIN, $format);
    return $result;
}
function getStringList($number = 1){
    $chunk = "%s ";
    $format = str_repeat($chunk, $number);
    $result = fscanf(STDIN, $format);
    return $result;
}

list($seller, $money) = getIntList(2);
$goodSeller = array();
$goods = array();
for ($i = 1; $i <= $seller; $i++) {
    $sellerData = explode(' ', trim(fgets(STDIN)));
    for ($j = 1; $j < $sellerData[0]; $j++) {
        if ($sellerData[$j] <= $money) {
            $goodSeller[] = $i;
            break;
        }
    }
}

if ($c = count($goodSeller)) {
    echo $c . PHP_EOL;
    echo implode(' ', $goodSeller);
} else {
    echo 0;
}
echo PHP_EOL;

?>

<?php
function getIntList($number = 1){
    $chunk = "%d ";
    $format = str_repeat($chunk, $number);
    $result = fscanf(STDIN, $format);
    return $result;
}
function getStringList($number = 1){
    $chunk = "%s ";
    $format = str_repeat($chunk, $number);
    $result = fscanf(STDIN, $format);
    return $result;
}

list($seller, $money) = getIntList(2);
$goodSeller = '';
$goods = array();
for ($i = 1; $i <= $seller; $i++) {
    $sellerData = explode(' ', fscanf(STDIN, '%s'));
    for ($j = 1; $j <= $sellerData[0]; $j++) {
        if ($sellerData[$j] <= $money) {
            $goodSeller .= $i . ' ';
            break;
        }
    }
}

echo (empty($goodSeller)) ? 0 : trim($goodSeller);
echo PHP_EOL;

?>

<?php
function getIntList($number = 1){
    $chunk = "%d ";
    $format = str_repeat($chunk, $number);
    $result = fscanf(STDIN, $format);
    return $result;
}
function getStringList($number = 1){
    $chunk = "%s ";
    $format = str_repeat($chunk, $number);
    $result = fscanf(STDIN, $format);
    return $result;
}

function task($goods, $money)
{

}

list($seller, $money) = getIntList(2);
$goodSeller = '';
$goods = array();
for ($i = 1; $i <= $seller; $i++) {
    $sellerData = explode(' ', fgets(STDIN));
    for ($j = 1; $j <= $sellerData[0]; $j++) {
        if ($sellerData[$j] <= $money) {
            $goodSeller .= $i . ' ';
            break;
        }
    }
}

echo (empty($goodSeller)) ? 0 : trim($goodSeller);
echo PHP_EOL;

?>

<?php
function getIntList($number = 1){
    $chunk = "%d ";
    $format = str_repeat($chunk, $number);
    $result = fscanf(STDIN, $format);
    return $result;
}

list($seller, $money) = getIntList(2);
$goodSeller = array();
$goods = array();
for ($i = 1; $i <= $seller; $i++) {
    $sellerData = explode(' ', trim(fgets(STDIN)));
    for ($j = 1; $j <= $sellerData[0]; $j++) {
        if ($sellerData[$j] <= $money) {
            $goodSeller[] = $i;
            break;
        }
    }
}
$c = count($goodSeller);
if ($c > 0) {
    echo $c . PHP_EOL;
    echo implode(' ', $goodSeller);
} else {
    echo 0;
}
echo PHP_EOL;

?>

<?php
function getIntList($number = 1){
    $chunk = "%d ";
    $format = str_repeat($chunk, $number);
    $result = fscanf(STDIN, $format);
    return $result;
}
function getStringList($number = 1){
    $chunk = "%s ";
    $format = str_repeat($chunk, $number);
    $result = fscanf(STDIN, $format);
    return $result;
}

function task($goods, $money)
{

}

list($seller, $money) = getIntList(2);
$goodSeller = '';
$goods = array();
for ($i = 1; $i <= $seller; $i++) {
    $sellerData = explode(' ', fgets(STDIN));
    for ($j = 1; $j <= $sellerData[0]; $j++) {
        if ($sellerData[$j] < $money) {
            $goodSeller .= $i . ' ';
            break;
        }
    }
}

echo (empty($goodSeller)) ? 0 : trim($goodSeller);
echo PHP_EOL;

?>


<?php
fscanf(STDIN, "%d", $n);

for ($i=1; $i<=$n; $i++) {
    if ($i != 1) {
        echo "that ";
    }
    if($i % 2 != 0){
        echo "I hate ";
    }
    else {
        echo "I love ";
    }
}
echo "it";
?>

<?php

$count = (int) trim(fgets(STDIN));

$string = 'I hate';
if ($count > 1) {
    for ($i = 2; $i <= $count; $i++) {
        $string .= ($i%2 == 0) ? ' that I love' : ' that I hate';
    }
}
$string .= ' it';
echo $string;

<?php

$x = intval(readline());

for($i=1; $i<=$x; $i++)
{
	if($i%2!=0)
		echo "I hate ";
	if($i%2==0)
		echo "I love ";
	if($i<$x)
		echo "that ";
	if($i == $x)
		echo "it\n";
}

<?php
$stdin = fopen("php://stdin", 'r');
fscanf($stdin, "%d\n", $n);
define("hate", "I hate");
define("love", "I love");
$answer = "";
for ($i = 0; $i < $n; $i++)
{
    if ($i % 2 === 0)
    {
        $answer .= hate;
    }
    else
    {
        $answer .= love;
    }
    if ($i + 1 < $n)
    {
        $answer .= " that ";
    }
}
$answer .= " it";
echo $answer;
?>

<?php

    fscanf(STDIN, "%d", $n);
    for ($i = 0; $i < $n; $i++) {
        if ($i % 2 == 0) {
            echo "I hate ";
        }
        else {
            echo "I love ";
        }
        if ($i != $n - 1) {
            echo "that ";
        }
    }
    echo "it";

?>

<?php
$n = fgets(STDIN);;
for ($i = 1; $i < $n; $i++) {
    if ($i & 1) echo 'I hate that ';
    else echo 'I love that ';
}
if ($n & 1) echo 'I hate it';
else echo 'I love it';
?>

<?php
$n = intval(readline());

$state = 0;
for($i = 0; $i < $n - 1; $i++)
{
	if($state == 0)
	{
		echo "I hate that ";
		$state = 1;
	}
	else if($state == 1)
	{
		echo "I love that ";
		$state = 0;
	}
}
if($state == 0)
	{
		echo "I hate it";
		$state = 1;
	}
	else if($state == 1)
	{
		echo "I love it";
		$state = 0;
	}
?>

<?php

$n = fgets(STDIN);
$result = [];
for ($i = 1; $i <= $n; $i++) {
    $end = $i == $n ? "it" : "that";
    $result[] = $i % 2 != 0 ? "I hate $end" : "I love $end";
}

echo implode(' ', $result);

<?php

$n=(int)fgets(STDIN);

for($i=1;$i<$n;$i++)    {
	if($i%2)    echo "I hate that ";
	else    echo "I love that ";
}

if($n%2)    echo "I hate it\n";
else    echo "I love it\n";

?>

<?php
fscanf(STDIN,"%d",$n);
for($i=1;$i<$n;$i++)
if($i%2==1)
echo "I hate that ";
else
echo "I love that ";
if($n%2==1)
echo "I hate it";
else
echo "I love it";
?>

<?php
$s = fopen("php://stdin", 'r');
$n = stream_get_contents($s);
	$str0 = "I hate";
	$str1 = "I hate it";
	$str2 = "I hate that I love it";
	$str3 = " that I hate that I love";
	$str4 = " that I love that I hate";
	$str5 = " it";
$str6 = "I hate that I love";

	if($n == 1){
		echo $str1;
	}elseif ($n == 2){
		echo $str2;
	}elseif ($n % 2 == 0){
		$z = ($n/2) - 1;
		$y = str_repeat($str3, $z);
		echo $str6.$y.$str5;
	}else{
		$v = floor($n/2);
		$b = str_repeat($str4, $v);
		echo $str0.$b.$str5;
	}

?>

<?php
$input=trim(fgets(STDIN));
$array=["I hate ","I love "];
$result=null;
for ($i=0; $i <$input;$i++) {
      if ($i % 2 == 0 and $i!=$input-1) {
            $result.=$array[0].'that ';
      }elseif($i % 2 == 1 and $i!=$input-1){
            $result.=$array[1].'that ';
      }elseif ($i % 2 == 0 and $i == $input-1) {
            $result.=$array[0].'it ';
      }elseif($i % 2 == 1 and $i == $input-1){
            $result.=$array[1].'it ';
      }

}
echo $result;

<?php
fscanf(STDIN,"%d",$n);
if($n==1)
echo "I hate it";
else{
$h="I hate ";
$l="I love ";

for($i=1;$i<=$n;$i++)
{
  if($i%2==1)
  	$str[$i]=$h;
  else
  	$str[$i]=$l;
}

$insert=implode('that ',$str);
$result=$insert."it";
echo $result;
}

<?php
$summa = readline();
$hate = 'I hate';
$love = 'I love';
$that = 'that';
$it = 'it';
$frasa = '';

for ($i=1; $i<$summa+1; $i++) {
    if ($i % 2 == 0) {
        $frasa = $frasa . $love . ' ';
    } else {
        $frasa = $frasa . $hate . ' ';
    }
    if ($i != $summa) {
        $frasa = $frasa .  $that . ' ';
    } else {
        $frasa = $frasa .  $it;
    }
    }
echo $frasa;

<?php
$n  = intval(trim(fgets(STDIN)));
$arr = [];
for($i = 1; $i <= $n; $i++){
    if($i % 2 == 0){
        $arr[] = "I love ";
    }else{
        $arr[] = "I hate ";
    }
}
echo join("that ",$arr) . "it" . PHP_EOL;
exit;

<?php

function check($s,$d)
{
    $c=0;$r=0;
    for ($i=0;$i<$d;$i++)
    {
        if($s[$i]=='A')$c++;
        else $r++;
    }

    if($c>$r)
        return "Anton";
    else if($c<$r)
        return "Danik";
    else
        return "Friendship";
}
function solve()
{
    $server="php://stdin";
    $local="input.txt";
    $handle = fopen($server, "r");
    $s="";$d=0;$t=0;
    $t = trim(fgets($handle));

    for ($i=1;$i<$t;$i++)
    {
        if($i%2!=0)printf("%s","I hate ");
        else printf("%s","I love ");
        printf("%s","that ");
    }
    if($t%2!=0)printf("%s","I hate it");
    else printf("%s","I love it");
}

solve();
?>

<?php
error_reporting(0);
$handle = fopen("php://stdin", "r");
$data = explode("\n", stream_get_contents(fopen("php://stdin", "r")));
$input = [];

foreach ($data as $index => $line) {
    $input[$index] = explode(" ", trim($line));
}

// Solve past this line
$layers = $input[0][0];
$hateLove = '';
$output = '';

for ($i = 0; $i < (int)$layers; $i++) {
    $hateLove = $hateLove == 'hate' ? 'love': 'hate';
    $output .= empty($output) ? "I $hateLove": " that I $hateLove";
}

echo $output . ' it';

<?php
error_reporting(0);
$n = readline();
$i = 1;
while($i<=$n)
{
    if($i != $n)
    {
    if($i%2 == 1)
    {
    $str .= 'I hate that ';
    }
    else
    {
      $str .= 'I love that ';
    }
    }
    else
    {

    if($i%2 == 1)
    {
    $str .= 'I hate it';
    }
    else
    {
      $str .= 'I love it';
    }
    }
    $i++;
    }
echo $str;
?>

<?php

//First Get The Input.
$input = file_get_contents("php://stdin");

function help ($n) {

    //Define Banner's Feelings.
    $feel = array("hate","love");

    $str = "";

    //Loop.
    for($i = 0;$i < $n;$i++) {

        //Check If It's Hate Or Love.
        $str .= "I " . $feel[$i % 2] . " that ";

    }

    return rtrim($str," that") . " it";

}

echo help($input);

?>

<?php

$count = (int) fgets(STDIN);

echo 'I hate';

for ($i = 2; $i <= $count; $i++) {
    if ($i % 2 == 0)
        echo ' that I love';
    else
        echo ' that I hate';
}

echo ' it' . PHP_EOL;

<?php

$num = (int)readline();

for ($i = 0; $i < $num; $i++) {
    if ($i % 2 == 0) {
        echo "I hate ";
    } else {
        echo "I love ";
    }
    if ($i != $num - 1) {
        echo "that ";
    } else {
        echo "it ";
    }
}

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:47
 */

class stdIn{var $ntxt = 0;var $nline = 0;var $arr_txt;var $arr_line;var $linex;var $liney;
    function stdIn($local = false){if($local){$dir = fopen("input.txt", 'r');}else{$dir = fopen("php://stdin", 'r');}
        $datatxt = stream_get_contents($dir);$del = Array("\n","\r","\n\r");$data = explode("\n",$datatxt);	$il = 0;$id = 0;
        foreach($data as $line){if(strlen($line) > 0){$line = str_replace($del,'',$line);$dataex[] = $line;$text = explode(" ",$line);
            foreach($text as $txt){$arr_txt[] = $txt;$this->linex[$id] = $il;$this->liney[$il] = $id;$id++;}}$il++;}$this->arr_line = $dataex;$this->arr_txt  = $arr_txt;}
    function G(){$ret = $this->arr_txt[$this->ntxt++];$this->nline = $this->linex[$this->ntxt];return $ret;}
    function GL(){$this->ntxt = $this->liney[$this->nline]+1;return $this->arr_line[$this->nline++];}} /*init*/

$inp = new stdIn(false);
$n = $inp->arr_line[0];
$hateLast = "I hate it";
$loveLast = "I love it";
$hate = "I hate that";
$love = "I love that";

$str_arr = [];
for ($i = 0; $i<$n; $i++){

     if($i%2==0){
         array_push($str_arr,$hate);
     }else{
         array_push($str_arr,$love);
     }
}

if($n%2!=0){
   $str_arr[$i-1]=$hateLast;
}else{
    $str_arr[$i-1]=$loveLast;
}
echo implode(" ",$str_arr);

<?php

$num = trim(fgets(STDIN));

$result  = '';
$array = [];
if($num > 0) {
    for($i = 1; $i <= $num; $i++){
        if($i%2 == 0) {
            $array[] = 'I love';
        } else {
            $array[] = 'I hate';
        }

    }
    $result = implode(' that ', $array) . ' it';
}

echo $result;

<?php

$count = (int) trim(fgets(STDIN));

$string = 'I hate';
if ($count > 1) {
    for ($i = 2; $i <= $count; $i++) {
        $string .= ($i%2 == 0) ? ' than I love' : ' than I hate';
    }
}
$string .= ' it';
echo $string;

<?php
    fscanf (STDIN, "%d", $n);
    $arr = array();
    array_unshift ($arr, 'I hate');

        for ($i = 1; $i < $n; $i++ ){
            if ($i % 2 != 0){
                $arr[$i] = ' that I love';
            }
            else $arr[$i] = ' that I hate';
        }
         array_push ($arr, ' it');
        for ($i = 0; $i < $n; $i++){
            echo $arr[$i];}

<?php
$n = fgets(STDIN);;
for ($i = 1; $i < $n; $i++) {
    if ($i & 1) echo 'I hate that ';
    else echo 'love that ';
}
if ($n & 1) echo 'I hate it';
else echo 'I love it';
?>

<?php

$n = fgets(STDIN);
$result = [];
for ($i = 1; $i <= $n - 1; $i++) {
    $end = $i == $n ? "it" : "that";
    $result[] = $i % 2 != 0 ? "I hate $end" : "I love $end";
}

echo implode(' ', $result);

<?php
$s = fopen("php://stdin", 'r');
$n = stream_get_contents($s);

	$str0 = "I hate";
	$str1 = "I hate it";
	$str2 = "I hate that I love it";
	$str3 = " that I hate that I love";
	$str4 = " that I love that I hate";
	$str5 = " it";

	if($n == 1){
		echo $str1;
	}elseif ($n == 2){
		echo $str2;
	}elseif ($n % 2 == 0){
		$z = ($n/2) - 1;
		$y = str_repeat($str3, $z);
		echo $str2.$y.$str5;
	}else{
		$v = floor($n/2);
		$b = str_repeat($str4, $v);
		echo $str0.$b.$str5;
	}

?>

<?php
$n = 2;

	$str1 = "I hate it";
	$str2 = "I hate it that I love it";
	$str3 = " that I hate it that I love it";
	$str4 = " that i love it that I hate it";

	if($n == 1){
		echo $str1;
	}elseif ($n == 2){
		echo $str2;
	}elseif ($n % 2 == 0){
		$z = ($n/2) - 1;
		$y = str_repeat($str3, $z);
		echo $str2.$y;
	}else{
		$v = floor($n/2);
		$b = str_repeat($str4, $v);
		echo $str1.$b;
	}

?>

<?php
$s = fopen("php://stdin", 'r');
$n = stream_get_contents($s);

	$str0 = "I hate";
	$str1 = "I hate it";
	$str2 = "I hate that I love it";
	$str3 = " that I hate it that I love it";
	$str4 = " that i love it that I hate it";

	if($n == 1){
		echo $str1;
	}elseif ($n == 2){
		echo $str2;
	}elseif ($n % 2 == 0){
		$z = ($n/2) - 1;
		$y = str_repeat($str3, $z);
		echo $str2.$y;
	}else{
		$v = floor($n/2);
		$b = str_repeat($str4, $v);
		echo $str0.$b;
	}

?>

<?php
$s = fopen("php://stdin", 'r');
$n = stream_get_contents($s);

	$str1 = "I hate it";
	$str2 = "I hate it that I love it";
	$str3 = " that I hate it that I love it";
	$str4 = " that i love it that I hate it";

	if($n == 1){
		echo $str1;
	}elseif ($n == 2){
		echo $str2;
	}elseif ($n % 2 == 0){
		$z = ($n/2) - 1;
		$y = str_repeat($str3, $z);
		echo $str2.$y;
	}else{
		$v = floor($n/2);
		$b = str_repeat($str4, $v);
		echo $str1.$b;
	}

?>

<?php
$s = fopen("php://stdin", 'r');
$n = stream_get_contents($s);

	$str0 = "I hate";
	$str1 = "I hate it";
	$str2 = "I hate that I love it";
	$str3 = " that I hate that I love it";
	$str4 = " that i love that I hate it";

	if($n == 1){
		echo $str1;
	}elseif ($n == 2){
		echo $str2;
	}elseif ($n % 2 == 0){
		$z = ($n/2) - 1;
		$y = str_repeat($str3, $z);
		echo $str2.$y;
	}else{
		$v = floor($n/2);
		$b = str_repeat($str4, $v);
		echo $str0.$b;
	}

?>

<?php
$s = fopen("php://stdin", 'r');
$n = stream_get_contents($s);

	$str1 = "I hate";
	$str2 = "I hate that I love it";
	$str3 = " that I hate it that I love it";
	$str4 = " that i love it that I hate it";

	if($n == 1){
		echo $str1;
	}elseif ($n == 2){
		echo $str2;
	}elseif ($n % 2 == 0){
		$z = ($n/2) - 1;
		$y = str_repeat($str3, $z);
		echo $str2.$y;
	}else{
		$v = floor($n/2);
		$b = str_repeat($str4, $v);
		echo $str1.$b;
	}

?>

<?php
$s = fopen("php://stdin", 'r');
$n = stream_get_contents($s);

	$str1 = "I hate it";
	$str2 = "I hate that I love it";
	$str3 = " that I hate it that I love it";
	$str4 = " that i love it that I hate it";

	if($n == 1){
		echo $str1;
	}elseif ($n == 2){
		echo $str2;
	}elseif ($n % 2 == 0){
		$z = ($n/2) - 1;
		$y = str_repeat($str3, $z);
		echo $str2.$y;
	}else{
		$v = floor($n/2);
		$b = str_repeat($str4, $v);
		echo $str1.$b;
	}

?>

<?php
fscanf(STDIN,"%d",$n);
if($n==1)
echo "I hate it";
else{
$h="I hate ";
$l="I love ";

for($i=1;$i<=$n;$i++)
{
  if($i%2==1)
  	$str[$i]=$h;
  else
  	$str[$i]=$l;
}

}
$insert=implode('that ',$str);
$result=$insert."it";
echo $result;

<?php
$n  = intval(trim(fgets(STDIN)));
$arr = [];
for($i = 0; $i < $n; $i++){
    if($i % 2 == 0){
        $arr[] = "I love ";
    }else{
        $arr[] = "I hate ";
    }
}
echo join("that ",$arr) . "it" . PHP_EOL;
exit;

<?php

function check($s,$d)
{
    $c=0;$r=0;
    for ($i=0;$i<$d;$i++)
    {
        if($s[$i]=='A')$c++;
        else $r++;
    }

    if($c>$r)
        return "Anton";
    else if($c<$r)
        return "Danik";
    else
        return "Friendship";
}
function solve()
{
    $server="php://stdin";
    $local="input.txt";
    $handle = fopen($server, "r");
    $s="";$d=0;$t=0;
    $t = trim(fgets($handle));

    for ($i=0;$i<$t-1;$i++)
    {
        if($i%2==0)printf("%s","I hate ");
        else printf("%s","I love ");
        printf("%s","that ");
    }
    if($t%2==0)printf("%s","I hate it");
    else printf("%s","I love it");
}

solve();
?>

<?php

//First Get The Input.
$input = file_get_contents("php://stdin");

function help ($n) {

    //Define Banner's Feelings.
    $feel = array("Hate","Love");

    $str = "";

    //Loop.
    for($i = 0;$i < $n;$i++) {

        //Check If It's Hate Or Love.
        $str .= "I " . $feel[$i % 2] . " That ";

    }

    return rtrim($str," That") . " It";

}

echo help($input);

?>

<?php

$num = trim(fgets(STDIN));

$result  = '';
$array = [];
if($num > 0) {
    for($i = 1; $i <= $num; $i++){
        if($i%2 == 0) {
            $array[] = 'I love';
        } else {
            $array[] = 'I hate';
        }

    }
    $result = implode(' that ') . ' it';
}

echo $result;


<?php
/**
 * Created by IntelliJ IDEA.
 * User: 低调的程序员
 * Date: 2015/4/25
 * Time: 1:17
 */

while(fscanf(STDIN,"%d",$n)){
        fscanf(STDIN,"%s",$word);
        $len=strlen($word);
$lastv=substr($word,0,1);
$ind=0;
$cnt=1;
for($i=1;$i<$n;$i++)
{
 $nowchar=substr($word,$i,1);

    if($nowchar!=$lastv)
    {
        if($lastv=='a' || $lastv=='e' || $lastv=='i' || $lastv=='o' || $lastv=='u' || $lastv=='y')
        {
            if(($lastv=='e' || $lastv=='o') && $cnt==2)
            {
                fprintf(STDOUT,"%s",$lastv);
                fprintf(STDOUT,"%s",$lastv);
            }
            else fprintf(STDOUT,"%s",$lastv);

        }
        else
        {
            while($cnt>0)
            {
                $cnt--;
                fprintf(STDOUT,"%s",$lastv);
            }
        }
$cnt=1;
    }
    else
    {
        $cnt++;
    }
    $lastv=$nowchar;
}

if($lastv=='a' || $lastv=='e' || $lastv=='i' || $lastv=='o' || $lastv=='u' || $lastv=='y')
        {
            if(($lastv=='e' || $lastv=='o') && $cnt==2)
            {
                fprintf(STDOUT,"%s",$lastv);
                fprintf(STDOUT,"%s",$lastv);
            }
            else fprintf(STDOUT,"%s",$lastv);
            $cnt=1;
        }
        else
        {
            while($cnt>0)
            {
                $cnt--;
                fprintf(STDOUT,"%s",$lastv);
            }
        }
}

<?php
 $in = fgets(STDIN);
 list($n, $x) = explode("\n", $in);
 $n = (int) $n;
 $str = fgets(STDIN);

 $ans = array();

 for ($i = 0; $i < $n;)
 {
 	switch ($str[$i])
 	{
 		case 'a':
 		case 'e':
 		case 'i':
 		case 'o':
 		case 'u':
 		case 'y':
 			$cnt = 0;

 			for ($j = $i; $j < $n; $j++)
 			{
 				if ($str[$j] == $str[$i])
 				{
 					$cnt++;
 				}
 				else
 				{
 					break;
 				}
 			}

 			$do = 1;

 			if ($cnt == 2)
 			{
 				if ($str[$i] == 'e' || $str[$i] == 'o')
 				{
 					array_push($ans, $str[$i]);
 					array_push($ans, $str[$i]);
 					$do = 0;
 				}
 			}

 			if ($do)
 			{
 				array_push($ans, $str[$i]);
 			}

 			$i += $cnt;

 			break;
 		default:
 			array_push($ans, $str[$i]);
 			$i++;
 	}
 }

 $pn = sizeof($ans);

 for ($i = 0; $i < $pn; $i++)
 {
 	echo $ans[$i];
 }
?>

<?php
$n = 0;
$str = "";
fscanf(STDIN, "%d\n", $n);
fscanf(STDIN, "%s\n", $str);
$pattern1 = '/([aiuy]){2,}/i';
$pattern2 = '/([oe]){3,}/i';
$str = preg_replace('/a{2,}/i', 'a', $str);
$str = preg_replace('/i{2,}/i', 'i', $str);
$str = preg_replace('/u{2,}/i', 'u', $str);
$str = preg_replace('/y{2,}/i', 'y', $str);
$str = preg_replace('/o{3,}/i', 'o', $str);
$str = preg_replace('/e{3,}/i', 'e', $str);
echo $str;

<?php

$s = file_get_contents('php://stdin');

$s .= '.';

$n = strlen($s);

$serija = ',';
$duzina = 0;

$activated = 0;

function kons($x) {
	switch($x) {
		case 'a': return false;
		case 'e': return false;
		case 'i': return false;
		case 'o': return false;
		case 'u': return false;
		case 'y': return false;
	}
	return true;
}

for ($i = 0; $i < $n; $i++) {
	$novo = $s[$i];

	if ($novo == '.') {
		if ((($serija == 'e' || $serija == 'o') && $duzina == 2) || kons($serija)) {
			for ($j = 0; $j < $duzina; $j++) {
				echo $serija;
			}
		} else if ($duzina > 0) {
			echo $serija;
		}
		break;
	}

	if (!is_numeric($novo) && $activated == 0) {
		$activated = 1;
		continue;
	}

	if ($activated == 1) {
		if ($novo == $serija) {
			$duzina++;
		} else {
			if ((($serija == 'e' || $serija == 'o') && $duzina == 2) || kons($serija)) {
				for ($j = 0; $j < $duzina; $j++) {
					echo $serija;
				}
			} else if ($duzina > 0) {
				echo $serija;
			}
			$serija = $novo;
			$duzina = 1;
		}
	}

}

<?php
$stdin = fopen('php://stdin', 'r');
$stdout = fopen('php://stdout', 'w');

$s1 = fgets($stdin);
$s = "0" . substr(fgets($stdin), 0, -1) . "0";

$L = strlen($s);

$res = "";
$gl = array("a", "e", "i", "o", "u", "y");
$gl_sp = array("o", "e");
$count = 0;
for($i = 1; $i < $L; $i++)
{
    if($s[$i] == $s[$i - 1])
    {
        $count++;
    }
    else
    {
        $pr = $s[$i - 1];
        if(in_array($pr, $gl_sp) && $count == 2)
        {
	    $res .= str_repeat($pr, $count);
        }
        else if(in_array($pr, $gl))
        {
            $res .= str_repeat($pr, $count > 0 ? 1 : 0);
        }
        else
        {
            $res .= str_repeat($pr, $count);
        }
        $count = 1;
    }
}

fputs($stdout, $res . "\n");
?>

<?php
function vowel($ch){
  return( $ch=="a" || $ch=="e" || $ch=="i" || $ch=="o" || $ch=="u" || $ch=="y" );
}
//$fl =STDIN;//fopen("input.txt","r");
$n=fgets(STDIN);
$s=fgets(STDIN);
$len=strlen($s);
$ans="";
for($i=0;$i<$len;){
  $ch=$s[$i];
  if(!vowel($ch)){
    $ans.=$ch;
    $i++;
    continue;
  }
  $cnt=0;
  while($i<$len && $s[$i]==$ch){
    $i++;
    $cnt++;
  }
  if($ch=="e" || $ch=="o"){
    if($cnt==2)$ans.=$ch.$ch;
    else $ans.=$ch;
  }
  else $ans.=$ch;
}
echo($ans);

<?php
$n = 0;
$str = "";
fscanf(STDIN, "%d\n", $n);
fscanf(STDIN, "%s\n", $str);
$pattern1 = '/([aiuy]){2,}/i';
$pattern2 = '/([oe]){3,}/i';
echo preg_replace($pattern2, '$1', preg_replace($pattern1, '$1', $str));

<?php
    $lg = trim(fgets(STDIN));
    $s = explode("", trim(fgets(STDIN)));
    $last = ".";
    for( $i = 0;  $i < $lg;  ++$i ) {
        if( $s[ $i ] != $last ) {
            print $s[ $i ];

        }
        $last = $s[ $i ];
    }
?>

<?php
    fscanf(STDIN, '%d', $lg);
    $s = trim(fgets(STDIN));
    $last = '.';
    $cat = 0;
    for( $i = 0;  $i < $lg;  ++$i ) {
        if( $last != $s[$i] ) {
        	$maxlg = 1;
        	if( $last == 'e' || $last == 'o' ) $maxlg = 2;
        	if( $last != '.' ) {
        		if( $cat != 2 ) $maxlg = 1;

        		for( $j = 0;  $j < $maxlg;  ++$j ) echo $last;
        	}

       		$cat = 1;
        }
        else {
        	++$cat;
        }
        $last = $s[$i];
    }
    $maxlg = 1;
	if( $last == 'e' || $last == 'o' ) $maxlg = 2;
	if( $last != '.' ) {
		if( $cat < $maxlg ) $maxlg = $cat;

		for( $j = 0;  $j < $maxlg;  ++$j ) echo $last;
	}

?>

<?php

// your code goes here
fscanf(STDIN, "%d\n", $number);
fscanf(STDIN, "%s\n", $word);

for($i=0;$i<$number;$i++){
	fwrite(STDOUT, $word[$i]);
	if($word[$i]=='e' ||$word[$i]=='o'){
		if($word[$i+1]==$word[$i] && $word[$i+1]==$word[$i+2]){
			while($word[$i]==$word[$i+1]){
				$i+=1;
			}
		}
	}else{
		while($word[$i]==$word[$i+1]){
				$i+=1;
			}
	}
}
fwrite(STDOUT, "\n");

<?php

// your code goes here
fscanf(STDIN, "%d\n", $number);
fscanf(STDIN, "%s\n", $word);

for($i=0;$i<$number;$i++){
	fwrite(STDOUT, $word[$i]);
	if($word[$i+1]==$word[$i] && $word[$i+1]==$word[$i+2]){
		while($word[$i]==$word[$i+1]){
			$i+=1;
		}
	}
}
fwrite(STDOUT, "\n");

<?php

$fl =STDIN;
fscanf($fl,"%s\n",$a);
fscanf($fl,"%s\n",$a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);

$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);

$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);

$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);

$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);

$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);

printf("%s\n",$a);
?>

<?php

$fl =STDIN;
fscanf($fl, "%s", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);

$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);

$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);

$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);

$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);

$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);

printf("%s\n",$a);
?>

<?php

$fl =STDIN;
fscanf($fl, "%d%s", $n, $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);
$a = str_replace("aa", "a", $a);

$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);
$a = str_replace("ee", "e", $a);

$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);
$a = str_replace("ii", "i", $a);

$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);
$a = str_replace("oo", "o", $a);

$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);
$a = str_replace("uu", "u", $a);

$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);
$a = str_replace("yy", "y", $a);

printf("%s\n",$a);
?>


<?php
    $j = trim(fgets(STDIN));
    $a = explode(' ', trim(fgets(STDIN)));
    $b = explode(' ', trim(fgets(STDIN)));
    $bo = false;
    $c = 0;
    $d = 0;
    foreach($a as $k => $v){
        $c += ($a[$k] - $b[$k]);
    }
    $d = ($c * ($c + 1)) / 2;
    $d -= 1;
    echo $d/2;

<?php
    $j = trim(fgets(STDIN));
    $a = explode(' ', trim(fgets(STDIN)));
    $b = explode(' ', trim(fgets(STDIN)));
    $bo = false;
    $c = 0;
    $d = 0;
    foreach($a as $k => $v){
        $c += ($a[$k] - $b[$k]);
    }
    $d = ($c * ($c + 1)) / 2;

    if($d > 1){
        $d -= 1;
        echo $d/2;
    } else {
        echo $d;
    }


<?php
/**
 * Created by PhpStorm.
 * User: jianzjzhang
 * Date: 2018/5/13
 * Time: 19:07
 */

function possiblePeople($arr, $capacity)
{
    $cur = 0;

    $min = 0;
    $max = 0;

    foreach ($arr as $x){
        $cur += $x;
        $min = min($cur, $min);
        $max = max($cur, $max);
    }

    if($max - $min > $capacity) return 0;
    return $capacity - ($max - $min) + 1;
}

function main()
{
    list($n, $w) = explode(" ", stream_get_line(STDIN, 4096, "\n"));
    $arr = array();

    for($i=0; $i<intval($n)-1; $i++){
        $arr[] = intval(stream_get_line(STDIN, 4096, " "));
    }
    $arr[] = intval(stream_get_line(STDIN, 4096, "\n"));

    echo possiblePeople($arr, $w)."\n";
}

main();

<?php

$handle = fopen("php://stdin", "r");

fscanf($handle, "%i %i", $n, $w);

$sequence = array_map('intval', explode(' ', trim(fgets($handle))));

$b = 0;
$min = 0;
$max = 0;

for($i = 0; $i < $n; $i++)
{
	$b += $sequence[$i];

	if($b > $max)
	{
		$max = $b;
	}
	elseif($b < $min)
	{
		$min = $b;
	}
}

if($max > $w || abs($min) > $w - $max)
{
	echo 0;
}
else
{
	echo ($w - $max) - (-min($min, 0)) + 1;
}

<?php

$handle = fopen("php://stdin", "r");

fscanf($handle, "%i %i", $n, $w);

$sequence = array_map('intval', explode(' ', trim(fgets($handle))));

$b = 0;
$min = 0;
$max = 0;

for($i = 0; $i < $n; $i++)
{
	$b += $sequence[$i];

	if($b > $max)
	{
		$max = $b;
	}
	elseif($b < $min)
	{
		$min = $b;
	}
}

if($max > $w)
{
	echo 0;
}
else
{
	echo ($w - $max) - (-min($min, 0)) + 1;
}


<?php
$stdout = fopen('php://stdout', 'w');
//fputs(STDOUT, "Vhodnie dannie:  ");
$h = fopen('php://stdin', 'r');
$t = (int)trim(fgets($h));
$s = trim(fgets($h));
$len=strlen($s);
if ($t>=3 && $t<=100)
    {
for ($i=1; $i<=$t-1; $i++)
{
    $r=stripos($s,' ');
    $posl[$i]=substr($s, 0, $r);
    if (($posl[$i]<1 && $posl[$i]>100))
    {$f=false;}
    $s=substr($s, $r+1, $len-$r-1);
    }
    $posl[$t]=$s;
    if (($posl[$t]<1 && $posl[$t]>100))
    {$f=false;}
//fputs(STDOUT, "Vihodnie dannie:  ");
    for ($i=1; $i<=$t; $i++)
    {
        $r=$posl[$i]%2;
        if($r==0){
        $chet[$i]=0;
        }
        else {$chet[$i]=1;}
        }
        $countc=0; $countnc=0;
        for ($i=1; $i<=$t; $i++)
        {
            if ($chet[$i]==0){$countc++; $k1=$i;}
            if ($chet[$i]==1){$countnc++; $k2=$i;}
            }
        if ($countc==1){fputs(STDOUT, "$k1");}
        elseif ($countnc==1){fputs(STDOUT, "$k2");}
    }
    /*else
    {fputs(STDOUT, "Число должно быть из диапозона 3<=n<=100");
        }*/
?>

<?
$n=trim(fgets(STDIN));
$arr=explode(' ',trim(fgets(STDIN)));
for($i=0;$i<$n;$i++){
    if($arr[$i]%2==0) $count0[]=$arr[$i];
    else $count1[]=$arr[$i];
}
if(sizeof($count0)==1) {
    foreach($arr as $k=>$v)
        if($v==$count0[0]) $res=$k+1;
}
elseif(sizeof($count1)==1) {
    foreach($arr as $k=>$v)
        if($v==$count1[0]) $res=$k+1;
}
echo $res;
?>

<?php
$number = fgets(STDIN);
$line = fgets(STDIN);

$line = trim($line);
$line = explode(' ', $line);	  	// cоздаем массив из строки

$evens = 0;
$odds = 0;

// разделяем массив на четные и нечетные
for ($i=0; $i < $number; $i++) {
	if (($line[$i] % 2) == 0) {
		$evens++;
	} else {
		$odds++;
	}
}

if ($evens > $odds) {
	foreach ($line as $key => $value) {
		if(($value % 2) != 0){
			$result = $key + 1;
		}
	}
} else {
	foreach ($line as $key => $value) {
		if(($value % 2) == 0){
			$result = $key + 1;
		}
	}
}

print_r($result);

<?php
$n = trim(fgets(STDIN));

$a = explode(' ',trim(fgets(STDIN)));

for($i=0;$i<$n;$i++) $a[$i] %= 2;

$b = array_count_values($a);

print array_search(array_search(1,$b),$a) + 1;

?>

<?
$fp=fopen('php://stdin', 'r');
$lines=stream_get_contents($fp);
$lines=trim($lines);
$lines=explode("\n", $lines);

$numbers=explode(" ", $lines[1]);
foreach ($numbers as $key=>$num)
{
    if ($num%2==0)
        $chet[]=$key+1;
    else
        $nechet[]=$key+1;
}

echo (count($chet)==1)?$chet[0]:$nechet[0];

?>

<?php

function debug($data, $die = true) {
    echo '<pre>';

    if (is_array($data)) {
        print_r($data);
    } else {
        var_dump($data);
    }

    if ($die) {
        die();
    }

    echo '</pre>';
}

function stdin() {
    $stdin = @fopen('data.txt', 'r');
    if (!$stdin) {
        $stdin = fopen('php://stdin', 'r');
    }

    return $stdin;
}

function g() {
    global $stdin;
    return trim(fgets($stdin));
}

$stdin = stdin();
/****************************************************** Solving block *****************************************************/
$n = g();
$numbers = explode(' ', g());

$n0cnt = $n1cnt = $n0 = $n1 = 0;

foreach($numbers as $key => $number) {
    if($number % 2 == 0) {
        $n0 = $key + 1;
        $n0cnt++;
    } else {
        $n1 = $key + 1;
        $n1cnt++;
    }
}

echo $n0cnt > $n1cnt ? $n1 : $n0;

?>

<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
$c = 0;
$d = array();
$e = array();
for($x = 0; $x < $a; $x++)
{
    if($b[$x] % 2 == 0)
    {
        array_push($d, $x) ;
    }
    else
    {
        array_push($e, $x);
    }
}
if(count($d) == 1)
{
    print $d[0] + 1;
}
else
{
    print $e[0] + 1;
}
?>

<?php

if (getenv('APPLICATION_ENV') == 'development') {
    $inputStream = STDIN;
    $outputStream = STDOUT;
} else {
    $inputStream = STDIN;
    $outputStream = STDOUT;
}

$n = fgets($inputStream);
$input = fgets($inputStream);

$nums = explode(' ', $input);
$res = array(0, 0);
$last = array(0, 0);
$c = 1;
foreach ($nums as $a) {
    $x = $a & 1;
    $res[$x]++;
    $last[$x] = $c++;
}

if ($res[0] < $res[1]) {
    $out = $last[0];
} else {
    $out = $last[1];
}

fwrite($outputStream, $out);

if (getenv('APPLICATION_ENV') == 'development') {
    fclose($inputStream);
    fclose($outputStream);
}

<?php

$n = readline();

$line = readline();
$numbers = explode(' ', $line);

$chet = 0;
$chetKey = 0;

$nechet = 0;
$nechetKey = 0;

foreach ($numbers as $key => $number) {
    if($number & 1){
        $nechet++;
        $nechetKey = $key;
    }else{
        $chet++;
        $chetKey = $key;
    }

    if($nechet > 1 && $chet == 1){
        echo $chetKey+1;
        break;
    }elseif($chet > 1 && $nechet == 1){
        echo $nechetKey+1;
        break;
    }
}

<?php
$fp=fopen('php://stdin', 'r');
$lines=stream_get_contents($fp);
$lines=trim($lines);
/*
$lines = '5
          2 4 7 8 10';

$lines = '4
          1 2 1 1';
*/
list($n , $numbers) = explode("\n",trim($lines));
$number = explode(" ", trim($numbers));
$genap = 0; $ganjil = 0;
for($i = 0 ; $i < count($number) ; $i++)
{
    if($number[$i] % 2 == 0)$genap++;
    else $ganjil++;
}
for($i = 0 ; $i < count($number) ; $i++)
{
    if($genap == '1')
    {
        if($number[$i] % 2 == 0){
            echo $i+1;
            break;
        }
    }
    else if($ganjil == '1')
    {
        if($number[$i] % 2 != 0)
        {
            echo $i+1;break;
        }
    }
}
?>

<?php
$n = trim(fgets(STDIN));
$numbers = array();
$numbers = explode(' ',trim(fgets(STDIN)));

$chetnaya = array();
$nechetnaya = array();

for( $i=0; $i<$n; $i++ ){
    if( $numbers[$i]%2 == 1 ){
        $nechetnaya[] = $i+1;
        //$nechetnaya[] = $numbers[$i];

    }elseif( $numbers[$i] == 1 ){
        $nechetnaya[] = $i+1;
    }else{
        $chetnaya[] = $i+1;
        //$chetnaya[] = $numbers[$i];
    }
}

if( sizeof($nechetnaya) == 1){
    echo $nechetnaya[0];
}elseif( sizeof($chetnaya) == 1 ){
    echo $chetnaya[0];
}

<?php
$n = trim(fgets(STDIN));
$line = explode(" ",trim(fgets(STDIN)));
$even=0;$odd=0;
for ($i=0;$i<$n;$i++)
{
    if ($line[$i]%2==0)
    {
        $even++;
        $evenPlace=$i;
    }
    else
    {
        $odd++;
        $oddPlace=$i;
    }
}
if ($even>$odd)echo $oddPlace+1;
else echo $evenPlace+1;

<?php
    $stdin = fopen('php://stdin', 'r');
    $stdout = fopen('php://stdout', 'w');

    $n = fgets($stdin);
    $numbers = fgets($stdin);
    $numbers = explode(" ", $numbers);

    for($i=2; $i<count($numbers);++$i){
        if((($numbers[$i]+$numbers[$i-1])%2) == 1){
            if((($numbers[$i]+$numbers[$i-2])%2) == 0){
                fputs($stdout, ($i-1)+1);
                return;
            }
            else {
                fputs($stdout, $i+1);
                return;
            }
        }
    }
    fputs($stdout, 1);

?>

<?php

function FindEvennessNumber($array_size,$array){

    $array     = explode(" ",$array);
    $even      = 0;
    $odd       = 0;
    $index     = 0;

    for($i=0;$i<3;$i++){
        if(($array[$i] % 2)==0)
            $even++;
        else
            $odd++;
    }
    for($i=0;$i<count($array);$i++){
        if($even<=1 && ($array[$i] % 2)==0){
            $index=$i;
            break;
        }
        elseif($odd<=1 && ($array[$i] % 2)!=0){
            $index=$i;
            break;
        }
    }

    return $index+1;
}

$array_size = trim(fgets(STDIN));
$array      = trim(fgets(STDIN));
echo FindEvennessNumber($array_size,$array);

<?php
// 25A  IQ тест
$in = fopen("php://stdin", 'r');

$input_line = fgets($in);
$n = (int) $input_line;

$input_line = fgets($in);
$arr = preg_split('/ /', substr($input_line, 0, strlen($input_line)-2), -1, PREG_SPLIT_NO_EMPTY);

function chet($a)
{
    if ((((int) $a) % 2) == 0 ) {
        return true;
    } else {
        return false;
    }
}

if ((chet($arr[0]) and chet($arr[1])) or
    (chet($arr[0]) and chet($arr[2])) or
    (chet($arr[1]) and chet($arr[2])))
{
    $flag = true;
} else {
    $flag = false;
}

for ($i=0; $i < $n ; $i++) {
    if ($flag) {
        if (!chet($arr[$i])) {
            break;
        }
    } else {
        if (chet($arr[$i])) {
            break;
        }

    }
}

echo $i + 1;

?>

<?php

$line0 = trim(fgets(STDIN));
$line1 = trim(fgets(STDIN));

$nums = explode(' ', $line1);

foreach ($nums as $key => $value) {
    if ($value % 2 == 0) {
        $even = $even + 1;
        $evenKeys[] = $key;
    }
    else {
        $odd = $odd + 1;
        $oddKeys[] = $key;
    }
}

if ($odd > $even) echo ($evenKeys[0] + 1);
else echo ($oddKeys[0] + 1);

?>

<?php
$fp=fopen('php://stdin', 'r');
$lines=stream_get_contents($fp);
$lines=trim($lines);
/*
$lines = '5
          2 4 7 8 10';
*/
list($n , $numbers) = explode("\n",trim($lines));
$number = explode(" ", $numbers);
$genap = 0; $ganjil = 0;
$angkaGenap = ""; $angkaGanjil = "";
for($i = 0 ; $i < count($number) ; $i++)
{
    if($number[$i] % 2 == 0)
    {
        $genap++;
        $angkaGenap = $number[$i];
        if($ganjil > 1)
        {
            echo $i;
            exit();
        }
    }
    else
    {
        $ganjil++;
        $angkaGanjil = $number[$i];
        if($genap > 1)
        {
            echo $i;
            exit();
        }
    }
}
?>

<?php
$fp=fopen('php://stdin', 'r');
$lines=stream_get_contents($fp);
$lines=trim($lines);
/*
$lines = '5
          2 4 7 8 10';
*/
list($n , $numbers) = explode("\n",trim($lines));
$number = explode(" ", $numbers);
$genap = 0; $ganjil = 0;
$angkaGenap = ""; $angkaGanjil = "";
for($i = 0 ; $i < count($number) ; $i++)
{
    if($number[$i] % 2 == 0)
    {
        $genap++;
        $angkaGenap = $number[$i];
        if($ganjil > 1)
        {
            echo ($i+1);
            exit();
        }
    }
    else
    {
        $ganjil++;
        $angkaGanjil = $number[$i];
        if($genap > 1)
        {
            echo ($i+1);
            exit();
        }
    }
}
?>

<?php
$fp=fopen('php://stdin', 'r');
$lines=stream_get_contents($fp);
$lines=trim($lines);
/*
$lines = '5
          2 4 7 8 10';
*/
list($n , $numbers) = explode("\n",trim($lines));
$number = explode(" ", $numbers);
$genap = 0; $ganjil = 0;
$angkaGenap = ""; $angkaGanjil = "";
for($i = 0 ; $i < count($number) ; $i++)
{
    if($number[$i] % 2 == 0)
    {
        $genap++;
        $angkaGenap = $number[$i];
        if($ganjil > 1)
        {
            echo $angkaGanjil;
            exit();
        }
    }
    else
    {
        $ganjil++;
        $angkaGanjil = $number[$i];
        if($genap > 1)
        {
            echo $angkaGanjil;
            exit();
        }
    }
}
?>

<?php
$fp=fopen('php://stdin', 'r');
$lines=stream_get_contents($fp);
$lines=trim($lines);
/*
$lines = '5
          2 4 7 8 10';
*/
list($n , $numbers) = explode("\n",trim($lines));
$number = explode(" ", $numbers);
$genap = 0; $ganjil = 0;
$angkaGenap = ""; $angkaGanjil = "";
for($i = 0 ; $i < count($number) ; $i++)
{
    if($number[$i] % 2 == 0)
    {
        $genap++;
        $angkaGenap = $number[$i];
        if($ganjil > 1)
        {
            echo ($i+1);
            break;
        }
    }
    else
    {
        $ganjil++;
        $angkaGanjil = $number[$i];
        if($genap > 1)
        {
            echo ($i+1);
            break;
        }
    }
}
?>

<?php

function FindEvennessNumber($array_size,$array){

    $array     = explode(" ",$array);
    $even      = 0;
    $odd       = 0;
    $index     = 0;

    for($i=0;$i<3;$i++){
        if(($array[$i] % 2)==0)
            $even++;
        else
            $odd++;
    }
    for($i=0;$i<count($array);$i++){
        if($even==1 && ($array[$i] % 2)==0){
            $index=$i;
            break;
        }
        elseif($odd==1 && ($array[$i] % 2)!=0){
            $index=$i;
            break;
        }
    }

    return $index+1;
}

$array_size = trim(fgets(STDIN));
$array      = trim(fgets(STDIN));
echo FindEvennessNumber($array_size,$array);

<?php
$stdout = fopen('php://stdout', 'w');
fputs(STDOUT, "Vhodnie dannie:  ");
$h = fopen('php://stdin', 'r');
$t = trim(fgets($h));
if ($k>=3 & $k<=100)
	{
for($i=1; $i<=$t; $i++)
{
	$posl[$i] = trim(fgets($h));
	}
fputs(STDOUT, "Vihodnie dannie:  ");
	for ($i=1; $i<=$t; $i++)
	{
		$r=$posl[$i]%2;
		if($r==0){
		$chet[$i]=0;
		}
		else {$chet[$i]=1;}
		}
		$countc=0; $countnc=0;
		for ($i=1; $i<=$t; $i++)
		{
			if ($chet[$i]==0){$countc++; $k1=$i;}
			if ($chet[$i]==1){$countnc++; $k2=$i;}
			}
		if ($countc==1){fputs(STDOUT, "$k1");}
		elseif ($countnc==1){fputs(STDOUT, "$k2");}
	}
	else
	{fputs(STDOUT, "����� ������ ���� �� ��������� 3<=n<=100");
		}
?>

<?php
$number = fgets(STDIN);
$line = fgets(STDIN);

$line = trim($line);
$line = explode(' ', $line);	  	// cоздаем массив из строки

if (($line[0] % 2) == 0) {
	foreach ($line as $key => $value) {
		if(($value % 2) != 0){
			$result = $key + 1;
		}
	}
} else {
	foreach ($line as $key => $value) {
		if(($value % 2) == 0){
			$result = $key + 1;
		}
	}
}

print_r($result);

<?php

if (getenv('APPLICATION_ENV') == 'development') {
    $inputStream = STDIN;
    $outputStream = STDOUT;
} else {
    $inputStream = STDIN;
    $outputStream = STDOUT;
}

$n = fgets($inputStream);
$input = fgets($inputStream);

$nums = explode(' ', $input);
$res = array(0, 0);
$last = array(0, 0);

foreach ($nums as $a) {
    $x = $a & 1;
    $res[$x]++;
    $last[$x] = $a;
}

if ($res[0] < $res[1]) {
    $out = $last[0];
} else {
    $out = $last[1];
}

fwrite($outputStream, $out);

if (getenv('APPLICATION_ENV') == 'development') {
    fclose($inputStream);
    fclose($outputStream);
}

<?php

$n = readline();

$line = readline();
$numbers = explode(' ', $line);

$chet = 0;
$chetKey = 0;

$nechet = 0;
$nechetKey = 0;

foreach ($numbers as $key => $number) {
    if($number & 1){
        $nechet++;
        $nechetKey = $key;
    }else{
        $chet++;
        $chetKey = $key;
    }

    if($nechet > 1 && $chet == 1){
        echo $chetKey+1;
        break;
    }elseif($chetKey > 1 && $nechet == 1){
        echo $nechetKey+1;
        break;
    }
}

<?php
$n = trim(fgets(STDIN));
$line = explode(" ",trim(fgets(STDIN)));
$even=0;$odd=0;
for ($i=1;$i<$n;$i++)
{
    if ($line[$i]%2==0)
    {
        $even++;
        $evenPlace=$i;
    }
    else
    {
        $odd++;
        $oddPlace=$i;
    }
}
if ($even>$odd)echo $oddPlace+1;
else echo $evenPlace+1;

<?php
    $stdin = fopen('php://stdin', 'r');
    $stdout = fopen('php://stdout', 'w');

    $n = fgets($stdin);
    $numbers = fgets($stdin);
    $numbers = preg_replace("/\s/", "", $numbers);

    for($i=2; $i<strlen($numbers);++$i){
        if((($numbers[$i]+$numbers[$i-1])%2) == 1){
            if((($numbers[$i]+$numbers[$i-2])%2) == 0){
                fputs($stdout, ($i-1)+1);
                return;
            }
            else {
                fputs($stdout, $i+1);
                return;
            }
        }
    }
    fputs($stdout, 1);

?>

<?php
    $stdin = fopen('php://stdin', 'r');
    $stdout = fopen('php://stdout', 'w');

    $n = fgets($stdin);
    $numbers = fgets($stdin);
    $numbers = explode(" ", $numbers);

    for($i=2; $i<strlen($numbers);++$i){
        if((($numbers[$i]+$numbers[$i-1])%2) == 1){
            if((($numbers[$i]+$numbers[$i-2])%2) == 0){
                fputs($stdout, ($i-1)+1);
                return;
            }
            else {
                fputs($stdout, $i+1);
                return;
            }
        }
    }
    fputs($stdout, 1);

?>


<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
rsort($b);
$c = trim(fgets(STDIN));
$d = explode(" ", trim(fgets(STDIN)));
asort($d);
$e = array_keys($d);
sort($d);
$f = array();
$g = 0;
for($x = 0; $x < $a; $x++)
{
     $g = bcadd($g, $b[$x]);
}
for($x = 0; $x < $c; $x++)
{
     $f[$e[$x]] = bcsub($g, $b[$d[$x] - 1]) . "\n";
}
ksort($f);
print implode($f);
?>

<?php

$n = trim(fgets(STDIN));
$p = explode(' ', trim(fgets(STDIN)));
$m = trim(fgets(STDIN));
$q = explode(' ', trim(fgets(STDIN)));

rsort($p);

$sum0 = 0;

for($i = 0; $i<$n; $i++){
    $sum0 = bcadd($sum0, $p[$i]);
}

$ans = "";

for($i = 0; $i<$m; $i++){
	$sum = bcsub($sum0, $p[$q[$i]-1]);

	$ans .= $sum."\n";
}

fwrite(STDOUT, trim($ans));

?>

<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
rsort($b);
$c = trim(fgets(STDIN));
$d = explode(" ", trim(fgets(STDIN)));
$f = "";
$g = 0;
for($x = 0; $x < $a; $x++)
{
     $g = bcadd($g, $b[$x]);
}
for($x = 0; $x < $c; $x++)
{
     $f .= bcsub($g, $b[$d[$x] - 1]) . "\n";
}
print $f;
?>

<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
rsort($b);
$c = trim(fgets(STDIN));
$d = explode(" ", trim(fgets(STDIN)));
asort($d);
$e = array_keys($d);
sort($d);
$f = array();
$g = array_sum($b);
for($x = 0; $x < $c; $x++)
{
     $f[$e[$x]] = bcsub($g, $b[$d[$x] - 1]) . "\n";
}
ksort($f);
print implode($f);
?>

<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
rsort($b);
$c = trim(fgets(STDIN));
$d = explode(" ", trim(fgets(STDIN)));
asort($d);
$e = array_keys($d);
sort($d);
$f = array();
$g = array_sum($b);
for($x = 0; $x < $c; $x++)
{
     $f[$e[$x]] = ($g - $b[$d[$x] - 1]) . "\n";
}
ksort($f);
print implode($f);
?>

<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
$c = trim(fgets(STDIN));
$d = explode(" ", trim(fgets(STDIN)));
asort($d);
$e = array_keys($d);
sort($d);
$f = array();
$g = 0;
for($x = 0; $x < $a; $x++)
{
     $g = bcadd($g, $b[$x]);
}
for($x = 0; $x < $c; $x++)
{
     $f[$e[$x]] = bcsub($g, $b[$d[$x] - 1]) . "\n";
}
ksort($f);
print implode($f);
?>

<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
rsort($b);
$c = trim(fgets(STDIN));
$d = explode(" ", trim(fgets(STDIN)));
asort($d);
$e = array_keys($d);
sort($d);
$f = array();
$g = array_sum($b);
for($x = 0; $x < $c; $x++)
{
     $f[$e[$x]] = ($g - $b[$d[$x] - 1]) . "\n";
}
print implode($f);
?>

<?php

$n = trim(fgets(STDIN));
$p = explode(' ', trim(fgets(STDIN)));
$m = trim(fgets(STDIN));
$q = explode(' ', trim(fgets(STDIN)));

rsort($p);

$sum0 = array_sum($p);
$ans = "";

for($i = 0; $i<$m; $i++){
	$sum = $sum0 - $p[$q[$i]-1];

	$ans .= $sum."\n";
}

fwrite(STDOUT, sprintf("%d", trim($ans)));

?>

<?php

$n = trim(fgets(STDIN));
$p = explode(' ', trim(fgets(STDIN)));
$m = trim(fgets(STDIN));
$q = explode(' ', trim(fgets(STDIN)));

rsort($p);

$sum0 = array_sum($p);
$ans = "";

for($i = 0; $i<$m; $i++){
	$sum = $sum0 - $p[$q[$i]-1];

	$ans .= sprintf("%d", $sum)."\n";
}

fwrite(STDOUT, trim($ans));

?>

<?php

$n = trim(fgets(STDIN));
$p = explode(' ', trim(fgets(STDIN)));
$m = trim(fgets(STDIN));
$q = explode(' ', trim(fgets(STDIN)));

rsort($p);

$sum0 = array_sum($p);
$ans = "";

for($i = 0; $i<$m; $i++){
	$sum = $sum0 - $p[$q[$i]-1];

	$ans .= $sum."\n";
}

fwrite(STDOUT, trim($ans));

?>

<?php

$n = trim(fgets(STDIN));
$p = explode(' ', trim(fgets(STDIN)));
$m = trim(fgets(STDIN));
$q = explode(' ', trim(fgets(STDIN)));

rsort($p);

$sum0 = array_sum($p);
$ans = "";

for($i = 0; $i<$m; $i++){
	$sum = $sum0 - $p[$q[$i]-1];

	$ans .= $sum." ";
}

fwrite(STDOUT, trim($ans));

?>

<?php

$n = trim(fgets(STDIN));
$p = explode(' ', trim(fgets(STDIN)));
$m = trim(fgets(STDIN));
$q = explode(' ', trim(fgets(STDIN)));

rsort($p);

$sum0 = 0;

for($i = 0; $i<$n; $i++){
    $sum0 = bcadd($sum, $p[$i]);
}

$ans = "";

for($i = 0; $i<$m; $i++){
	$sum = bcsub($sum0, $p[$q[$i]-1]);

	$ans .= $sum."\n";
}

fwrite(STDOUT, trim($ans));

?>


<?php

$tests = getLineInt();

$results = array();

for ($test = 0; $test < $tests; $test++)
{
    list($m, $s) = getLineInts();

    $partial = getLineInts();

    $partialMax = max($partial);

    $currInt = 1;
    $currSum = 0;

    while ($currSum < $s)
    {
        if (!in_array($currInt, $partial))
        {
            $currSum += $currInt;
        }

        $currInt++;
    }

    if ($currInt < $partialMax)
    {
        for ($i = $currInt; $i <= $partialMax; $i++)
        {
            if (!in_array($i, $partial))
            {
                break;
            }

            $currInt = $i;
        }
    }

    $results[] = $s <= 0 || $currSum > $s || $currInt < $partialMax ? "NO" : "YES";
}

echo(implode(PHP_EOL, $results));

// Helpers

function getLineInt()
{
    return (int) trim(fgets(STDIN));
}

function getLineInts()
{
    return array_map("intval", explode(' ', trim(fgets(STDIN))));
}

function getString()
{
    return trim(fgets(STDIN));
}

function getWords()
{
    return explode(' ', trim(fgets(STDIN)));
}

<?php
//[$n,$m] = array_map('intval', explode(' ', trim(fgets(STDIN))));
[$t] = array_map('intval', explode(' ', trim(fgets(STDIN))));
//$a = array_map('intval', explode(' ', trim(fgets(STDIN))));
//[$s,$t] = explode(' ', trim(fgets(STDIN)));
//[$s] = explode(' ', trim(fgets(STDIN)));
//$s = explode(' ', trim(fgets(STDIN)));
//function decr($v){return --$v;}
//$alpha='abcdefghijklmnopqrstuvwxyz';
//$mod=1000000009;
//$mod=1000000007;
//$mod=998244353;
//$a=[];
//$b=[];
for($i=0;$i<$t;$i++){
    [$n, $s] = array_map('intval', explode(' ', trim(fgets(STDIN))));
    $a = array_map('intval', explode(' ', trim(fgets(STDIN))));
    $set = [];
    for($j=0;$j<$n;$j++){
        $set[$a[$j]]=true;
    }
    for($j=1;$j<=200;$j++){
        if(isset($set[$j])) {
            unset($set[$j]);
            if(count($set) == 0 && $s == 0){
                break;
            }
            continue;
        }
        $s -= $j;
        if(count($set) == 0 && $s == 0){
            break;
        }
    }
    if(count($set) == 0 && $s == 0){
        $ans[] = "YES";
    }else{
        $ans[] = "NO";
    }
}
echo implode(PHP_EOL, $ans);

<?php

$tests = getLineInt();

$results = array();

for ($test = 0; $test < $tests; $test++)
{
    list($m, $s) = getLineInts();

    $partial = getLineInts();

    $partialMax = max($partial);

    $currInt = 1;
    $currSum = 0;

    while ($currSum < $s)
    {
        if (!in_array($currInt, $partial))
        {
            $currSum += $currInt;
        }

        $currInt++;
    }

    $results[] = $s <= 0 || $currSum > $s || $currInt < $partialMax ? "NO" : "YES";
}

echo(implode(PHP_EOL, $results));

// Helpers

function getLineInt()
{
    return (int) trim(fgets(STDIN));
}

function getLineInts()
{
    return array_map("intval", explode(' ', trim(fgets(STDIN))));
}

function getString()
{
    return trim(fgets(STDIN));
}

function getWords()
{
    return explode(' ', trim(fgets(STDIN)));
}

<?php

$tests = getLineInt();

$results = array();

for ($test = 0; $test < $tests; $test++)
{
    list($m, $s) = getLineInts();

    $partial = getLineInts();

    $maxPartial = max($partial);

    $currInt = 1;
    $currSum = 0;

    while ($currSum < $s)
    {
        if (!in_array($currInt, $partial))
        {
            $currSum += $currInt;
        }

        $currInt++;
    }

    $results[] = $currSum > $s || $currInt < $maxPartial ? "NO" : "YES";
}

echo(implode(PHP_EOL, $results));

// Helpers

function getLineInt()
{
    return (int) trim(fgets(STDIN));
}

function getLineInts()
{
    return array_map("intval", explode(' ', trim(fgets(STDIN))));
}

function getString()
{
    return trim(fgets(STDIN));
}

function getWords()
{
    return explode(' ', trim(fgets(STDIN)));
}

<?php

$tests = getLineInt();

$pattern = "Yes";

$patternLength = strlen($pattern);

$results = array();

for ($test = 0; $test < $tests; $test++)
{
    list($m, $s) = getLineInts();

    $b = getLineInts();

    $results[] = in_array($s, $b) ? "NO" : "YES";
}

echo(implode(PHP_EOL, $results));

// Helpers

function getLineInt()
{
    return (int) trim(fgets(STDIN));
}

function getLineInts()
{
    return array_map("intval", explode(' ', trim(fgets(STDIN))));
}

function getString()
{
    return trim(fgets(STDIN));
}

function getWords()
{
    return explode(' ', trim(fgets(STDIN)));
}

<?php
//[$n,$m] = array_map('intval', explode(' ', trim(fgets(STDIN))));
[$t] = array_map('intval', explode(' ', trim(fgets(STDIN))));
//$a = array_map('intval', explode(' ', trim(fgets(STDIN))));
//[$s,$t] = explode(' ', trim(fgets(STDIN)));
//[$s] = explode(' ', trim(fgets(STDIN)));
//$s = explode(' ', trim(fgets(STDIN)));
//function decr($v){return --$v;}
//$alpha='abcdefghijklmnopqrstuvwxyz';
//$mod=1000000009;
//$mod=1000000007;
//$mod=998244353;
//$a=[];
//$b=[];
for($i=0;$i<$t;$i++){
    [$n, $s] = array_map('intval', explode(' ', trim(fgets(STDIN))));
    $a = array_map('intval', explode(' ', trim(fgets(STDIN))));
    $set = [];
    for($j=0;$j<$n;$j++){
        $set[$a[$j]]=true;
    }
    for($j=1;$j<=50;$j++){
        if(isset($set[$j])) {
            unset($set[$j]);
            if(count($set) == 0 && $s == 0){
                break;
            }
            continue;
        }
        $s -= $j;
        if(count($set) == 0 && $s == 0){
            break;
        }
    }
    if(count($set) == 0 && $s == 0){
        $ans[] = "YES";
    }else{
        $ans[] = "NO";
    }
}
echo implode(PHP_EOL, $ans);

<?php
//[$n,$m] = array_map('intval', explode(' ', trim(fgets(STDIN))));
[$t] = array_map('intval', explode(' ', trim(fgets(STDIN))));
//$a = array_map('intval', explode(' ', trim(fgets(STDIN))));
//[$s,$t] = explode(' ', trim(fgets(STDIN)));
//[$s] = explode(' ', trim(fgets(STDIN)));
//$s = explode(' ', trim(fgets(STDIN)));
//function decr($v){return --$v;}
//$alpha='abcdefghijklmnopqrstuvwxyz';
//$mod=1000000009;
//$mod=1000000007;
//$mod=998244353;
//$a=[];
//$b=[];
for($i=0;$i<$t;$i++){
    [$n, $s] = array_map('intval', explode(' ', trim(fgets(STDIN))));
    $a = array_map('intval', explode(' ', trim(fgets(STDIN))));
    $set = [];
    for($j=0;$j<$n;$j++){
        $set[$a[$j]]=true;
    }
    for($j=1;$j<=50;$j++){
        if(isset($set[$j])) continue;
        $set[$j] = true;
        $s -= $j;
        if($s == 0){
            ksort($set);
            $ok=true;
            for($x=1;$x<=count($set);$x++){
                if(!isset($set[$x])){
                    $ok = false;
                    break;
                }
            }
            if($ok) $ans[] = "YES";
            else $ans[] = "NO";
            break;
        }
        if($s < 0){
            $ans[] = "NO";
            break;
        }
    }
}
echo implode(PHP_EOL, $ans);