jiahuimbzuai/CoQuIR huggingface dataset:
//  [javascript]
function Main(input) {
  tmp = input.split("\n");

  var length = parseInt(tmp.shift(), 10);
  var max = 0;
  var next_max = 0;
  var max_index = 0;
  var value = 0;

  for (var i = 0; i < tmp.length; i++) {
    // 1つ目に大きい数字と、2つ目に大きい数字を見つける
    value = parseInt(tmp[i], 10);

    if (max < value) {
      next_max = max;
      max = value;
      max_index = i;
    } else if (next_max < value) {
      next_max = value;
    }
  }

  var answer = "";
  for (var x = 0; x < length; x++) {
    if (x == max_index) {
      answer += (next_max + "\n");
    } else {
      answer += (max + "\n");
    }
  }

  console.log('%s', answer.slice(0, -1));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict'

const INF = 900719925474099;
function mapint(temp){
  return temp.split(' ').map((v)=>parseInt(v));
}

function Main(input){
  let temp = input.trim().split('\n');
  let n = temp[0];
  let a = new Array(n);
  let f = 0;
  let s = 0;

  for(let i=1;i<=n;i++){
    a[i-1] = parseInt(temp[i]);
    if(f<=a[i-1]){
      s = f;
      f = a[i-1];
    }else if(s<a[i-1]){
      s = a[i-1];
    }
  }

  let ans = new Array(n);
  for(let i=0;i<n;i++){
    if(f == a[i]){
      ans[i] = s;
    }else{
      ans[i] = f;
    }
  }
  console.log(ans.join('\n'));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";
const input = require("fs").readFileSync("/dev/stdin", "utf8");
const inputs = input.trim().split("\n");

const get = (inputs) => {
  const As = inputs.slice(1);
  
  let max = 1;
  let max2 = 1;
  for (const A of As) {
    const a = +A;
    if (max < a) {
      max = a;
    } else if (max2 < a) {
      max2 = a;
    }
  }
  
  return As.map(A => +A === max ? max2 : max).join("\n")
}

console.log( get(inputs) );
//  [javascript]
function Main(input){
    const arr = input.trim().split('\n');
    const N = Number(arr.shift());
    for(let i=0; i<arr.length; i++){
        const box = arr.concat();
        box.splice(i, 1);
        console.log(Math.max.apply(null, box));
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input){
    const arr = input.trim().split('\n');
    const N = Number(arr.shift());
    for(let i=0; i<arr.length; i++){
        const box = arr.concat();
        box.splice(i, 1);
        console.log(String(Math.max.apply(null, box)));
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input){
    const arr = input.split('\n');
    const N = Number(arr.shift());
    for(let i=0; i<arr.length; i++){
        const box = arr.concat(); // 引数なしなら新しい配列が作成される
        box.splice(i, 1);
        console.log(Math.max.apply(null, box));
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

const (
	maxBufferSize     = 2000000 // check
	initialBufferSize = 20000
)

func Max(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}

func JoinInt(a []int, sep string) string {
	aStrs := make([]string, len(a))
	for i := 0; i < len(a); i++ {
		aStrs[i] = strconv.Itoa(a[i])
	}
	return strings.Join(aStrs, sep)
}

func solve() {
	sc := bufio.NewScanner(os.Stdin)
	buffer := make([]byte, initialBufferSize)
	sc.Buffer(buffer, maxBufferSize)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	a := make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
	}

	m0 := make([]int, n+1)
	m1 := make([]int, n+1)
	for i := 1; i <= n; i++ {
		m0[i] = Max(m0[i-1], a[i-1])
	}
	for i := n - 1; i >= 0; i-- {
		m1[i] = Max(m1[i+1], a[i])
	}

	ans := make([]int, n)
	for i := 0; i < n; i++ {
		ans[i] = Max(m0[i], m1[i+1])
	}

	buf := JoinInt(ans, "\n")

	fmt.Println(buf)
}

func main() {
	solve()
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	a := make([]int, n)
	max1, max2 := 0, 0
	for i := 0; i < n; i++ {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
		if a[i] > max1 {
			max1, max2 = a[i], max1
			continue
		}
		if a[i] > max2 {
			max2 = a[i]
		}
	}

	wr := bufio.NewWriter(os.Stdout)
	for _, v := range a {
		if v == max1 {
			wr.WriteString(strconv.Itoa(max2) + "\n")
		} else {
			wr.WriteString(strconv.Itoa(max1) + "\n")
		}
	}
	wr.Flush()
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	n := scanInt(sc)

	ns := make([]int, n)
	first := 0
	second := 0
	for i := 0; i < n; i++ {
		n := scanInt(sc)
		ns[i] = n

		if first < n {
			second = first
			first = n
		} else if second < n {
			second = n
		}
	}

	w := bufio.NewWriter(os.Stdout)
	for i := 0; i < n; i++ {
		if ns[i] == first {
			fmt.Fprintln(w, second)
		} else {
			fmt.Fprintln(w, first)
		}
	}
	w.Flush()
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func max(i, j int) int {
	if i > j {
		return i
	} else {
		return j
	}
}

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)

	n := nextInt()
	a := make([]int, n)

	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}

	x := make([]int, n)
	y := make([]int, n)

	x[0] = a[0]
	y[n-1] = a[n-1]

	for i := 1; i < n; i++ {
		x[i] = max(x[i-1], a[i])
	}
	for i := n - 2; i >= 0; i-- {
		y[i] = max(y[i+1], a[i])
	}

	fmt.Println(y[1])
	for i := 1; i < n-1; i++ {
		fmt.Println(max(x[i-1], y[i+1]))
	}
	fmt.Println(x[n-1])
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func max(i, j int) int {
	if i > j {
		return i
	} else {
		return j
	}
}

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)

	n := nextInt()
	a := make([]int, n)

	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}

	x := make([]int, n)
	y := make([]int, n)

	x[0] = a[0]
	y[n-1] = a[n-1]

	for i := 1; i < n; i++ {
		x[i] = max(x[i-1], a[i])
	}
	for i := n - 2; i >= 0; i-- {
		y[i] = max(y[i+1], a[i])
	}

	fmt.Println(y[1])
	for i := 1; i < n-1; i++ {
		fmt.Println(max(x[i]-1, y[i+1]))
	}
	fmt.Println(x[n-1])
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	sc = initScanner(os.Stdin)
	n := scanInt(sc)
	a := scanIntSlice(sc, n)

	resolve(n, a)
}

func resolve(n int, a []int) {
	var max int
	for i:=0; i<n;i++ {
		max = 0
		for j:=0;j<n;j++ {
			if i == j {
				continue
			}
			if max < a[j] {
				max = a[j]
			}
		}
		fmt.Println(max)
	}
}

// --------------- BASE DEFINITIONS ---------------

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanIntSlice(sc *bufio.Scanner, n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = scanInt(sc)
	}

	return is
}

func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanStringSlice(sc *bufio.Scanner, n int) []string {
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		ss[i] = sc.Text()
	}

	return ss
}
//  [ruby]
gets
t = ARGF.map(&:to_i)
max2 = max = 0
t.each do |d|
  if(d > max)
    max2 = max
    max = d
    next
  end
  if(d > max2)
    max2 = d
  end
end
t.each do |d|
  if(d==max)
    print "#{max2}\n"
  else
    print "#{max}\n"
  end
end
//  [ruby]
gets
t = ARGF.map(&:to_i)
max2 = max = 0
t.each do |d|
  if(d > max)
    max2 = max
    max = d
    next
  end
  if(d > max2)
    max2 = d
  end
end
t.each do |d|
  if(d!=max)
    print "#{max}\n"
  else
    print "#{max2}\n"
  end
end
//  [ruby]
n=gets.to_i
a=Array.new(n,0)
n.times do |i|
    a[i]=gets.to_i
end

a_max=a.max
a_second=a.max(2)[1]
n.times do |i|
    if a[i]==a_max
        puts a_second
    else
        puts a_max
    end
end
//  [ruby]
n=gets.to_i
s=[]
n.times{|i|
  s[i]=gets.to_i
}
max=s.max(2)
n.times{|i|
  if i==max[0]
    puts max[1]
  else
    puts max[0]
  end
}
//  [ruby]
n = gets.to_i
array = []
while number = gets
  array << number.chomp.to_i
end
for i in 1..n
  ary = array.delete_at(i-1)
  puts ary.max
end
//  [ruby]
n = gets.to_i
arr = []
n.times do
  arr.push(gets.to_i)
end
if arr.count(arr.max) != 1
  n.times do
    puts arr.max
  end
else
  arr.freeze
  new_arr = arr.dup
  new_arr.delete(arr.max)
  second = new_arr.max
  arr.each do |num|
    if num == arr.max
      puts second
    else
      puts arr.max
    end
  end
end
//  [rust]
use std::io::*;

// const SP: u8 = b' ';
const LF: u8 = b'\n';

struct CharacterInput<'a> {
    locked_stdin: StdinLock<'a>,
    bytes_buffer: Vec<u8>,
}

impl<'a> CharacterInput<'a> {
    fn read(&mut self, delimiter: u8) -> &[u8] {
        self.bytes_buffer.clear();

        let mut len = self
            .locked_stdin
            .read_until(delimiter, &mut self.bytes_buffer)
            .unwrap();

        if len > 0 {
            len -= 1;
        }

        &self.bytes_buffer[0..len]
    }

    fn scan_u(&mut self, delimiter: u8) -> u32 {
        self.read(delimiter)
            .into_iter()
            .fold(0, |accumulator, byte| {
                (byte - b'0') as u32 + accumulator * 10
            })
    }

    fn scan_u_vec(&mut self, n: usize, separator: u8, delimiter: u8) -> Vec<u32> {
        let mut vector = Vec::with_capacity(n as usize);
        for _i in 0..n - 1 {
            vector.push(self.scan_u(separator));
        }
        vector.push(self.scan_u(delimiter));
        vector
    }
}

fn create_cin<'a>(input: StdinLock<'a>, buffer_capacity: usize) -> CharacterInput {
    CharacterInput {
        locked_stdin: input,
        bytes_buffer: Vec::with_capacity(buffer_capacity),
    }
}

struct CharacterOutput {
    string_buffer: String,
}

impl CharacterOutput {
    fn push_s(&mut self, s: &str) {
        self.string_buffer += s;
    }

    fn add_s(&mut self, s: &str, separator: char) {
        self.push_s(s);
        self.string_buffer.push(separator);
    }

    fn push<T: ToString>(&mut self, n: T) {
        self.push_s(&n.to_string());
    }

    fn add<T: ToString>(&mut self, n: T, separator: char) {
        self.push(n);
        self.string_buffer.push(separator);
    }

    fn add_from_iterator<T: ToString, I>(
        &mut self,
        iterator: &mut I,
        length: usize,
        separator: char,
        delimiter: char,
    ) where
        I: Iterator<Item = T>,
    {
        for element in iterator.by_ref().take(length - 1) {
            self.add(element, separator);
        }
        self.add(iterator.next().unwrap(), delimiter);
    }

    fn flush(&mut self) {
        let out = stdout();
        let mut out = out.lock();
        out.write_all(self.string_buffer.as_bytes()).unwrap();
        self.string_buffer.clear();
    }
}

fn create_cout(capacity: usize) -> CharacterOutput {
    CharacterOutput {
        string_buffer: String::with_capacity(capacity),
    }
}

// ------------------------------------------------------------------------

fn main() {
    let cin = stdin();
    let cin = &mut create_cin(cin.lock(), 16);

    let mut max_a = 0;
    let mut second_max_a = 0;

    let n = cin.scan_u(LF) as usize;
    let a: Vec<u32> = (0..n)
        .map(|_| {
            let a_i = cin.scan_u(LF);

            if a_i > max_a {
                max_a = a_i;
            } else if a_i > second_max_a {
                second_max_a = a_i;
            }

            a_i
        })
        .collect();

    let cout = &mut create_cout(7 * n);

    for a_i in a {
        if a_i < max_a { cout.add(max_a, '\n'); }
        else { cout.add(second_max_a, '\n') }
    }

    cout.flush();
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [usize; n]
    };

    let a: Vec<usize> = a;
    let max = a.iter().max().unwrap();

    for i in 0..n {
        if a[i] == *max {
            let mut x = a.clone();
            x[i] = 0;
            println!("{}", x.iter().max().unwrap());
        } else {
            println!("{}", max);
        };
    }
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [usize; n]
    };

    let a: Vec<usize> = a;

    for i in 0..n {
        let mut x = a.clone();
        x[i] = 0;
        println!("{}", x.iter().max().unwrap());
    }
}
//  [rust]
use whiteread::parse_line;

fn main() {
    let n: usize = parse_line().unwrap();
    let mut a: Vec<u32> = Vec::new();
    for _ in 0..n {
        a.push(parse_line().unwrap());
    }
    for i in 0..n {
        let mut cp: Vec<u32> = a.iter().copied().collect();
        cp.remove(i);
        println!("{}", cp.iter().max().unwrap());
    }
}
//  [swift]
let N = (Int)(readLine()!)!;
var maximum = 0;
var secondMaximum = 0;
var count: Array<Int> = Array(repeating: 0, count: 200020);
var A: Array<Int> = Array(repeating: 0, count: 200020);
for i in 0 ..< N {
    let a = (Int)(readLine()!)!;
    A[i] = a;
    if a > maximum {
        secondMaximum = maximum;
        maximum = a;
    }
    else if a > secondMaximum {
        secondMaximum = a;
    }
    count[a] += 1;
} 
for i in 0 ..< N {
    if A[i] != maximum {
        print(maximum);
    }
    else if A[i] == maximum && count[A[i]] == 1 {
        print(secondMaximum);
    }
    else {
        print(maximum);
    }
}
//  [swift]
import Foundation
let n = Int(readLine()!)!
var a: [Int] = .init(repeating: 0, count: n)
for i in 0..<n {
  a[i] = Int(readLine()!)!
}
let sort = a.sorted()
let maxV = sort.last!
let maxVPrev = sort[sort.count - 2]

for i in 0..<n {
  if maxV == maxVPrev {
    print(maxV)
  } else if maxV == a[i] {
    print(maxVPrev)
  } else {
    print(maxV)
  }
}
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = index(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let n = readInt()
    var dicA = [Int: Int]()
    for i in 0..<n {
        dicA[i] = readInt()
    }
    
    let dicASorted = dicA.sorted { $0.value > $1.value }
    for i in 0..<n {
        for d in dicASorted {
            if d.key == i {
                continue
            } else {
                print(d.value)
                break
            }       
        }
    }
}
main()
//  [swift]
let n = Int(readLine()!)!


func solve(_ a: [Int]) -> [Int] {
  let n = a.count
  var ans: [Int] = .init(repeating: 0, count: n + 1)
  for i in (1...n).reversed() {
    var sum = 0
    var j = i + i
    while j <= n {
      sum ^= j
      j += i
    }
    ans[i] = sum ^ a[i]
  }
  return ans
}

var a: [Int] = .init(repeating: 0, count: n + 1)
let inputs = readLine()!
	.split(separator: " ")
	.map { Int($0)! }
	.enumerated()
	.forEach { a[$0+1] = $1 }

let ans = solve(a)

if ans.isEmpty {
  print(-1)
} else {
  let res = ans.enumerated().filter { $1 == 1 }
  print(res.count)
  res.forEach { print($0.0 + 1) }
}
//  [typescript]
export class Main {
  static main(input): string {
    const tmp: string[] = input.split("\n");
    const n: number = parseInt(tmp[0].split(" ")[0]);
    const list: number[] = [];
    let max1: number = 0;
    let max2: number = 0;
    for (let i = 1; i <= n; i++) {
      const a: number = parseInt(tmp[i].split(" ")[0]);
      list.push(a);
      if (max1 < a) {
        if (max2 < max1) {
          max2 = max1;
        }
        max1 = a;
      } else if (max2 < a || max1 == a) {
        max2 = a;
      }
    }
    const isMaxDouble: boolean = max1 == max2;
    const result: number[] = [];
    for (let i = 0; i < n; i++) {
      if (!isMaxDouble && list[i] == max1) {
        result.push(max2);
      } else {
        result.push(max1);
      }
    }
    return `${result.join("\n")}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [typescript]
'use strict'
const main = (input: string) => {
    // for-n1はTLE
    // sortして1番目と2番目出せればいい？
    const std: number[] = input.trim().split('\n').map(Number)
    const n: number = std.shift()
    const a: number[] = std
    const s: number[] = [...a].sort((a,b)=>b-a)
    let r: number[] = []
    for (let i = 0; i < n; i++) {
        if (a[i] !== s[0]) {
            r.push(s[0])
        } else {
            r.push(s[1])
        }
    }
    console.log(r.join('\n'))
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [typescript]
function main(input) {
  input = input.trim().split("\n");
  const n = Number(input[0]);
  const as = input.slice(1).map(n => Number(n));
  const sortedAs = as.slice();
  sortedAs.sort((a, b) => a - b);
  const max = sortedAs[sortedAs.length - 1];
  const nextMax = sortedAs[sortedAs.length - 2];
  const result = [];
  for (const a of as) {
    if (a === max) {
      result.push(nextMax);
    } else {
      result.push(max);
    }
  }
  console.log(result.join("\n");
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};
const main=()=>{
  let n=tn()
  let ar=tnn(n)
  let m=Math.max(...ar)
  // let m2=0
  // let c=0
  // for(let i=0;i<n;i++){
  //   if(m==ar[i])c++
  //   else m2=max(m2,ar[i])
  //   if(c==2){
  //     m2=m
  //     break
  //   }
  // }
  // for(let i=0;i<n;i++){
  //   to(ar[i]!=m?m:m2)
  // }
}
main()
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};
const main=()=>{
  let n=tn()
  let ar=tnn(n)
  // let m=max(...ar)
  // let m2=0
  // let c=0
  // for(let i=0;i<n;i++){
  //   if(m==ar[i])c++
  //   else m2=max(m2,ar[i])
  //   if(c==2){
  //     m2=m
  //     break
  //   }
  // }
  // for(let i=0;i<n;i++){
  //   to(ar[i]!=m?m:m2)
  // }
}
main()
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};
const main=()=>{
  let n=tn()
  let ar=tnn(n)
  let m=max(...ar)
  // let m2=0
  // let c=0
  // for(let i=0;i<n;i++){
  //   if(m==ar[i])c++
  //   else m2=max(m2,ar[i])
  //   if(c==2){
  //     m2=m
  //     break
  //   }
  // }
  // for(let i=0;i<n;i++){
  //   to(ar[i]!=m?m:m2)
  // }
}
main()
//  [python]
x = list(map(int, input().split()))
for i in range(5):
    if x[i] != i + 1:
        print(i + 1)
        exit()
//  [python]
x=list(map(int,input().split()))
print(x.index(0)+1)
//  [python]
l = list(map(int,input().split()))

for i in range(len(l)):
    if (l[i] == 0):
        print(i+1)
        break
//  [python]
data = [int(x) for x in input().split(" ")]

for i in range(len(data)):
  if data[i] == 0: print(i)
//  [python]
l = list(map(int, input().split()))
for i in range(5):
    if l[i] == 0:
        print(i)
//  [python]
x = list[map(int,input().split())]
print(x.index(0) + 1)
//  [java]
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		
	 		StringTokenizer st = new StringTokenizer(bf.readLine());
	 		int a = Integer.parseInt(st.nextToken());
	 		int b = Integer.parseInt(st.nextToken());
	 		int c = Integer.parseInt(st.nextToken());
	 		int d = Integer.parseInt(st.nextToken());
	 		int e = Integer.parseInt(st.nextToken());
	 		
 		if (a == 0){
 			out.println(1);
 		}
 		else if (b == 0){
 			out.println(2);
 		}
 		else if (c == 0){
 			out.println(3);
 		}
 		else if (d == 0){
 			out.println(4);
 		}
 		else if (e == 0){
 			out.println(5);
 		}
 		
 		
 		out.println();
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 

    for(int i = 0; i < 5; i++){
      int a = sc.nextInt();
      if(a == 0){System.out.println(i+1);}
    }
    
 
  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}
//  [java]
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.NoSuchElementException;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AFiveVariables solver = new AFiveVariables();
        solver.solve(1, in, out);
        out.close();
    }

    static class AFiveVariables {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            ArrayList<Integer> list = new ArrayList<>();
            while (in.hasNext()) list.add(in.nextInt());

            out.println(list.indexOf(0) + 1);
        }

    }

    static class Scanner {
        private final InputStream in;
        private final byte[] buffer;
        private int ptr;
        private int buflen;

        public Scanner(InputStream in) {
            this.in = in;
            this.buffer = new byte[1024];
            this.ptr = 0;
            this.buflen = 0;
        }

        private boolean hasNextByte() {
            if (ptr < buflen) return true;
            else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) return false;
            }
            return true;
        }

        private byte readByte() {
            if (hasNextByte()) return buffer[ptr++];
            return -1;
        }

        private boolean isPrintableChar(byte c) {
            return '!' <= c && c <= '~';
        }

        private void skipUnprintable() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
                ptr++;
            }
        }

        public boolean hasNext() {
            skipUnprintable();
            return hasNextByte();
        }

        public int nextInt() {
            if (!hasNext()) throw new NoSuchElementException();
            int n = 0;
            boolean minus = false;
            byte b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

    }
}
//  [java]
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int input = in.nextInt();
        int inp = in.nextInt();
        int output = variable(input, inp);
        System.out.println(output);
    }
    // x1, x2, x3, x4, x5 = 1 2 3 0 4

    public static int variable(int i, int number) {
        for (i = 0; i <= 5; i++) {
            if (number == 0) {
                
            }
        }
        return i;

    }



}
//  [java]
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int A;
        for(int i=0;i<5;i++){
            A=sc.nextInt();
            if(A==0){
                System.out.println(i);
                return;
            }
        }
        
        
	}
}
//  [java]

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

   private static final String INPUT_FILE_PATH = "";

   static void solve(InputReader in, PrintWriter out) {
      int[] a = new int[5];
      for (int i = 1; i <= 5; i++) {
         a[i] = in.nextInt();
         if (a[i] == 0) {
            out.println(i);
            return;
         }
      }
   }

   private static class InputReader {
      private BufferedReader br;
      private StringTokenizer st;

      public InputReader(InputStream inputStream) {
         this.br = new BufferedReader(new InputStreamReader(inputStream), 32768);
         this.st = null;
      }

      public String nextToken() {
         while (st == null || !st.hasMoreTokens()) {
            try {
               st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
               throw new RuntimeException(e);
            }
         }
         return st.nextToken();
      }

      public int nextInt() {
         return Integer.parseInt(nextToken());
      }

      public long nextLong() {
         return Long.parseLong(nextToken());
      }

      public double nextDouble() {
         return Double.parseDouble(nextToken());
      }
   }

   public static void main(String[] args) throws Exception {
      InputStream inputStream = INPUT_FILE_PATH.isEmpty()
         ? System.in
         : new FileInputStream(new File(INPUT_FILE_PATH));
      OutputStream outputStream = System.out;

      InputReader inputReader = new InputReader(inputStream);
      PrintWriter printWriter = new PrintWriter(outputStream);

      solve(inputReader, printWriter);

      printWriter.close();
   }

}
//  [cpp]
#include <stdio.h>

int main()
{
	int a,b,c,d,e;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
	if(a==0) printf("1");
	else if(b==0) printf("2");
	else if(c==0) printf("3");
	else if(d==0) printf("4");
	else if(e==0) printf("5");
}
//  [cpp]
#include <stdio.h>
#include <string.h>

int main()
{
	int ans = 0;
	for (int i = 0; i < 5; i++) {
		int x;
		scanf("%d", &x);
		if (x == 0) {
			ans = i + 1;
		}
	}
	printf("%d\n", ans);
	return 0;
}
//  [cpp]
#include <cstdio>


int main(){

    for(int i=1;i<=5;i++){
        int temp;
        scanf("%d\n",&temp);
        if (temp==0) printf("%d\n",i);
    }

    return 0;
}
//  [cpp]
#include <iostream>
using namespace std;
int main(){
int x;
cin >> x;
if(x[0] == 0) cout << x[0] << endl;
else if(x[1] == 0) cout << x[1] << endl;
else if(x[2] == 0) cout << x[2] << endl;
else if(x[3] == 0) cout << x[3] << endl;
else if(x[4] == 0)cout << x[4] << endl;

}
//  [cpp]
#include <iostream>
using namespace std;

int main(){
  int a,b,c,d,e;
  cin >> a >> " " >> b >> " " >> c >> " " >> d >> " " >> e;
  if (a==0){
    cout << "1";
  }
  else if (b==0){
    cout << "2";
  }
  else if (c==0){
    cout << "3";
  }
  else if (d==0){
    cout << "4";
  }
  else{
    cout << "5";
  }
}
//  [cpp]
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int ar[5];
    for(int i=1; i<=5; i++)
    {
        cin>>ar[i];
    }
    for(int i=1; i<=5; i++)
    {
        if(ar[i]==0)
        {
            cout<<i<<endl;
        }
    }
    return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define rep(i,n) for(int i=0;i<n;i++)
int gcd(int a, int b){
    int r=1;
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
void revStr(char* str){
    int size = strlen(str);
    int i,j;
    char tmp = {0};
    for(i = 0, j = size - 1; i < size / 2; i++, j--){
        tmp = str[i];
        str[i] = str[j];
        str[j] = tmp;
    }return;
}
struct data{
    int a,b;
};

//小さい順
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}


int main(){
    int a[5];
    for(int i=0;i<5;i++){
        scanf("%d",&a[i]);
    }
    for(int i=0;i<5;i++){
        if(a[i]==0){
            printf("%d",i+1);
            return 0;
        }
    }
}
//  [c]
#include<stdio.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#define rep(i,n) for(int i=0; i <(n); i++)
int main(){
  int a[5];
  rep(i,5){
    scanf("%d",&a[i]);
    if(a[i]==0){
      printf("%d\n",i+1);
    }
  }
  return 0;
}
//  [c]
#include<stdio.h>


int main(){

    int a,b,c,d,e;
    scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);

    if(a!=1){
        printf("1");
        return 0;
    }
    if(b!=2){
        printf("2");
        return 0;
    }
    if(c!=3){
        printf("3");
        return 0;
    }
    if(d!=4){
        printf("4");
        return 0;
    }
    if(e!=5){
        printf("5");
        return 0;
    }
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,x;
    for(i=0;i<5;i++)
    {
        if(scanf("%d",&x)==0)
            printf("%d",i+1);
    }
    return 0;
}
//  [c]
#include<stdio.h>
#include<math.h>
 
int main()
{
  long long int x,y,a,b;
  scanf("%lld %lld",&x,&y);
  
 if ( ( 4*x-y) % 2 ==0 && (4*x-y)>=0 && (y-2*x) % 2 ==0)
 {
 	printf("Yes");
   return 0;
 }
  
  printf("No");
  
  return 0;
}
//  [c]
#include<stdio.h>
#include<math.h>
 
int main()
{
  int x,y,a,b;
  scanf("%d %d",&x,&y);
  
 if ( ( 4*x-y) % 2 ==0 && (4*x-y)>0 )
 {
 	printf("Yes");
   return 0;
 }
  
  printf("No");
  
  return 0;
}
//  [javascript]
"use strict";

const main = (arg) => {
  const input = arg.trim().split("\n")[0];
  const numbers = input.split(" ");
  for (let i = 0; i < numbers.length; i++) {
    if (parseInt(numbers[i]) === 0) return console.log(i + 1);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main(input) {
  // 入力値の分離
  param = input.split(" ");
  var calc = 0;
  for(var i = 0; i < param.length; i++){
    calc += parseInt(param[i]);
  }
  var base = 1+2+3+4+5;
  const result = base - calc;
  console.log(parseInt(result));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));parseInt
//  [javascript]
function main(lines) {
  const input = lines.split(' ')
  let count = 0;
  for(let i=0; i<input.length; i++){
      count++
      if(input[i] == 0){
          break;
      }
  }
  console.log(count)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
#include<stdio.h>
 
int main (){
  int x[5];
  int x_length = sizeof x / sizeof x[0];
  for(int i = 0;i < x_length;i++){
    scanf("%d",&x[i]);
  }
 
  for(int i = 0;i < x_length;i++){
    if(x[i] == 0){
      printf("%d",i+1);
    }
  }
  return 0;
}
//  [javascript]
'use strict'


const main = (arg) => {
    console.log(arg);
    const nums = arg.split(" ");
    nums.forEach((num,index) => {
        if(num==0) console.log(index+1);
    });
}

main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [javascript]
const main = (array) => {
    const args = array.split(" ")
    console.log(args.findIndex(element => element === "0") + 1)
}

main(require("fs").readFileSync('/dev/stdin', 'utf8'))
//  [go]
package main

import "fmt"

func main() {

	var x [5]int

	fmt.Scan(&x[0], &x[1], &x[2], &x[3], &x[4])

	for i, j := range x {
		if j == 0 {
			fmt.Println(i + 1)
			break
		}
	}

}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*1)

func main() {
	list := getStdinIntArr()
	for idx, val := range list {
		if val == 0 {
			fmt.Printf("%d\n", idx+1)
			break
		}
	}
}

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}

func getStdinArr() []string {
	str := getStdin()
	list := strings.Split(str, " ")
	return list
}

func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}

func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, e := sc.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}
//  [go]
package main

import "fmt"

func main() {
	for i := 0; i < 5; i++ {
		var a int
		fmt.Scan(&a)
		if a == 0 {
			fmt.Println(i + 1)
		}
	}
}
//  [go]
func main() {
  
	var list [5]int

	fmt.Scan(&list[0], &list[1], &list[2], &list[3], &list[4]) // スペース区切りなのでそのままScanで取れる

	fmt.Println(list)

	// 0を代入したポジションを返す
	pos := func(arr [5]int, e int) int {
		for i, v := range arr {
			if v == e { return i + 1 }
		}
		return -1
	}(list, 0)

	fmt.Println(pos)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	a()
}

func a() {
	var list [5]int

	fmt.Scan(&list[0], &list[1], &list[2], &list[3], &list[4])

	fmt.Println(list)

	// 0を代入したポジションを返す
	pos := func(arr [5]int, e int) int {
		for i, v := range arr {
			if v == e { return i + 1 }
		}
		return -1
	}(list, 0)

	fmt.Println(pos)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	a()
}

func a() {
	var list [5]int

	fmt.Scan(&list[0], &list[1], &list[2], &list[3], &list[4]) // スペース区切りなのでそのままScanで取れる

	fmt.Println(list)

	// 0を代入したポジションを返す
	pos := func(arr [5]int, e int) int {
		for i, v := range arr {
			if v == e { return i + 1 }
		}
		return -1
	}(list, 0)

	fmt.Println(pos)
}
//  [ruby]
arr = gets.split.map(&:to_i)

cnt = 1

arr.each do |x|
    if x == 0
        puts cnt
        break
    end
    cnt += 1
end
//  [ruby]
X = $stdin.gets.split.map {|i| i.to_i }
X.each_with_index do |x, i|
  if x == 0
    puts i + 1
    exit
  end
end
//  [ruby]
line = gets.split(' ')
p line.index('0') + 1
//  [ruby]
x = gets.split.map(&:to_i)
for i in 0..4
  if x[i] == 0
    puts x[i]+1
    break
  end
end
//  [ruby]
x = gets.split.map(&:to_i)
for i in 0..4
  if x[i] == 0
    puts x+1
    break
  end
end
//  [ruby]
arr = gets.chomp.split().map(&:to_i)
a = arr.select { |i| i == 0 }
print(a.map{|i| i+1}.join(' '))
//  [rust]
use std::io::*;
use std::str::FromStr;

fn main() {
	let mut temp: u32;
	for i in 1..6 {
		temp = read();
		if temp == 0 {
			println!("{}", i);
		}
	}
}

fn read<T: FromStr>() -> T {
	let stdin = stdin();
	let stdin = stdin.lock();
	let token: String = stdin
		.bytes()
		.map(|c| c.expect("failed to read char") as char)
		.skip_while(|c| c.is_whitespace())
		.take_while(|c| !c.is_whitespace())
		.collect();
	token.parse().ok().expect("failed to parse token")
}
//  [rust]
fn main() {
    let (x1, x2, x3, x4, x5) = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let mut iter = s.split_whitespace().map(|i| i.parse::<i32>().unwrap());
        (
            iter.next().unwrap(),
            iter.next().unwrap(),
            iter.next().unwrap(),
            iter.next().unwrap(),
            iter.next().unwrap(),
        )
    };
    if x1==0{
        println!("1");
    }
    if x2==0{
        println!("2");
    }
    if x3==0{
        println!("3");
    }
    if x4==0{
        println!("4");
    }
    if x5==0{
        println!("5");
    }
}
//  [rust]
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        xs: [usize; 5]
    }

    for i in 0..5 {
        if xs[i] == 0 {
            println!("{}", i+1);
        }
    }
}
//  [rust]
//! # Bundled libraries

fn main() {
    todo!();
}

// The following code was expanded by `cargo-equip`.
//  [swift]
let inputs = readLine()!.split(separator: " ")
for i in 0..<inputs.count {
  if inputs[i] == "0" {
    print(i + 1)
  }
}
//  [swift]
class A {
    static func solve() {
        let xs = readLine()!.split(separator: " ")
        if xs[0] != "1" {
            print("1")
        } else if xs[1] != "2" {
            print("2")
        } else if xs[2] != "3" {
            print("3")
        } else if xs[3] != "4" {
            print("4")
        } else if xs[4] != "5" {
            print("5")
        }
    }
}

A.solve()
//  [swift]
class Scanner {
    private var stack = [String]()
    private var index = 0
    
    func peek() -> String {
        if stack.count == index {
            stack += readLine()!.split(separator: " ").map{ String($0) }
        }
        return stack[index]
    }
    
    func next() -> String {
        let value = peek()
        index += 1
        return value
    }
    
    func nextInt() -> Int {
        return Int(next())!
    }
    
    func nextDouble() -> Double {
        return Double(next())!
    }
}

var scanner = Scanner()
var A = [Int]()
for _ in 0 ..< 5 {
    A.append(scanner.nextInt())
}
print(A.firstIndex(where: { $0 == 0 })! + 1)
//  [swift]
var str = readLine()!
str = str.replacingOccurrences(of: " ", with: "")
for (i, v) in str.enumerated() {
    if v == "0" {
        print(i + 1)
    }
}
//  [swift]
class D {
    static func solve() {
        let _ = readLine()
        let _As = readLine()!.split(separator: " ").map { Int($0)! }
        let As = Array(Set(_As)).sorted()

        if As.count <= 1 {
            print("0")
            return
        }

        var ans = 0
        for i in 0..<As.count {
            var found = false
            for j in 0..<As.count {
                if i != j && As[i] % As[j] == 0 {
                    found = true
                    break
                }
            }
            if !found {
                ans += 1
            }
        }

        print(ans)
    }
}

D.solve()
//  [swift]
let a = readLine()!.split(separator: " ").map({Int($0)})
for i in 0 ..< 5 {
    if a[i] != i {
        print(i+1)
    }
}
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const X = input[0].map(Number);

  let answer = 0;

  X.forEach((x, index) => {
    if (x === 0) {
      answer = index + 1;
    }
  });

  return answer;
};

console.log(main(read()));
//  [typescript]
// import std = require('tstl')

{
  type Print = void | string | number | string[] | number[]
  let outs: Print[] = []

  const main = (): Print => {
    const r = _io()
    const x = r.nn()

    return x.indexOf(0) + 1
  }

  const _io = (i = 0) => {
    const str = require('fs').readFileSync('/dev/stdin', 'utf8')
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')

    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map((v) => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  outs.push(main())

  console.log(
    outs
      .map((line) => (typeof line === 'object' ? line.join(' ') : String(line)))
      .join('\n')
  )
}
//  [typescript]
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const x: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    for (let i = 1; i <= 5; i++) {
      if (x[i - 1] == 0) {
        return `${i}`;
      }
    }
    return `No`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [typescript]
import * as fs from "fs";
const x = fs.readFileSync("/dev/stdin", "utf8").split(" ").map(item => parseInt(item));

console.log(solve(x));

function solve(x: number[]): number {
    return x.findIndex((item) => item == 0)
}
//  [typescript]
import * as fs from "fs";

// one line
const input = fs.readFileSync("/dev/stdin", "utf8").split(" ");

console.log(input.indexOf("0") + 1);
//  [typescript]
import * as fs from 'fs';

const input = fs.readerFileSync('/dev/stdin', "utf8");
console.log(input.split(" ").findIndex(0) + 1);
//  [python]
def main():
    s=input()
    s+="R"
    n=len(s)
    ans=[0]*(n-1)
    res="R"
    resRL=0
    cnt=0
    cntR=0
    for i in range(n):
        if s[i]==res:
            cnt+=1
            if s[i]=="R":
                cntR+=1
        elif s[i]=="L":
            cnt+=1
            res="L"
            resRL=i
        else:
            if cnt%2==0:
                ans[resRL-1]=cnt//2
                ans[resRL]=cnt//2
            elif cntR%2==0:
                ans[resRL-1]=cnt//2
                ans[resRL]=cnt//2+1
            else:
                ans[resRL-1]=cnt//2+1
                ans[resRL]=cnt//2
            cnt=1
            cntR=1
            res="R"
            resRL=0
    print(" ".join(str(_) for _ in ans))
if __name__=="__main__":
    main()