import java.util.*;

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

public class Main {
  
  public static void main(String[] args) {
    
    Scanner scan = new Scanner(System.in);
    
    for (int i = 1; i <= 5; i++) {
      int A_i = scan.nextInt();
      if (A_i != i) {
        System.out.println(i);
        return;
      }
    }
  }
}
