import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int[] x = new int[4];
    int[] y = new int[5];
    int c = 0;
    for(int i=0; i<5; i++){
      int a = sc.nextInt();
      if(a!=0){
        x[c] = a;
        c++;
      }
      y[i] = i+1;
    }
    Arrays.sort(x);
    for(int i=0; i<5; i++){
      if(i<4 && x[i]!=y[i]){
        System.out.println(y[i]);
        break;
      }
      else if(i==4){
        System.out.println(5);
      }
    }
  }
} import java.util.*; util.* java class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int[] x = new int[4];
    int[] y = new int[5];
    int c = 0;
    for(int i=0; i<5; i++){
      int a = sc.nextInt();
      if(a!=0){
        x[c] = a;
        c++;
      }
      y[i] = i+1;
    }
    Arrays.sort(x);
    for(int i=0; i<5; i++){
      if(i<4 && x[i]!=y[i]){
        System.out.println(y[i]);
        break;
      }
      else if(i==4){
        System.out.println(5);
      }
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int[] x = new int[4];
    int[] y = new int[5];
    int c = 0;
    for(int i=0; i<5; i++){
      int a = sc.nextInt();
      if(a!=0){
        x[c] = a;
        c++;
      }
      y[i] = i+1;
    }
    Arrays.sort(x);
    for(int i=0; i<5; i++){
      if(i<4 && x[i]!=y[i]){
        System.out.println(y[i]);
        break;
      }
      else if(i==4){
        System.out.println(5);
      }
    }
  } main {
    Scanner sc = new Scanner(System.in);
    
    int[] x = new int[4];
    int[] y = new int[5];
    int c = 0;
    for(int i=0; i<5; i++){
      int a = sc.nextInt();
      if(a!=0){
        x[c] = a;
        c++;
      }
      y[i] = i+1;
    }
    Arrays.sort(x);
    for(int i=0; i<5; i++){
      if(i<4 && x[i]!=y[i]){
        System.out.println(y[i]);
        break;
      }
      else if(i==4){
        System.out.println(5);
      }
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] x = new int[4]; x new int[4] 4 int[] y = new int[5]; y new int[5] 5 int c = 0; c 0 for(int i=0; i<5; i++){
      int a = sc.nextInt();
      if(a!=0){
        x[c] = a;
        c++;
      }
      y[i] = i+1;
    } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
      int a = sc.nextInt();
      if(a!=0){
        x[c] = a;
        c++;
      }
      y[i] = i+1;
    } {
      int a = sc.nextInt();
      if(a!=0){
        x[c] = a;
        c++;
      }
      y[i] = i+1;
    } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc if(a!=0){
        x[c] = a;
        c++;
      } a!=0 a 0 {
        x[c] = a;
        c++;
      } x[c] = a x[c] x c a c++ c y[i] = i+1 y[i] y i i+1 i 1 Arrays.sort(x) Arrays.sort Arrays x for(int i=0; i<5; i++){
      if(i<4 && x[i]!=y[i]){
        System.out.println(y[i]);
        break;
      }
      else if(i==4){
        System.out.println(5);
      }
    } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
      if(i<4 && x[i]!=y[i]){
        System.out.println(y[i]);
        break;
      }
      else if(i==4){
        System.out.println(5);
      }
    } {
      if(i<4 && x[i]!=y[i]){
        System.out.println(y[i]);
        break;
      }
      else if(i==4){
        System.out.println(5);
      }
    } if(i<4 && x[i]!=y[i]){
        System.out.println(y[i]);
        break;
      }
      else if(i==4){
        System.out.println(5);
      } i<4 && x[i]!=y[i] i<4 i 4 x[i]!=y[i] x[i] x i y[i] y i {
        System.out.println(y[i]);
        break;
      } System.out.println(y[i]) System.out.println System.out System System.out y[i] y i break; if(i==4){
        System.out.println(5);
      } i==4 i 4 {
        System.out.println(5);
      } System.out.println(5) System.out.println System.out System System.out 5 String[] args args
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int[] x = new int[4];
    int[] y = new int[5];
    int c = 0;
    for(int i=0; i<5; i++){
      int a = sc.nextInt();
      if(a!=0){
        x[c] = a;
        c++;
      }
      y[i] = i+1;
    }
    Arrays.sort(x);
    for(int i=0; i<5; i++){
      if(i<4 && x[i]!=y[i]){
        System.out.println(y[i]);
        break;
      }
      else if(i==4){
        System.out.println(5);
      }
    }
  }
}