import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] a = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = scan.nextInt();
        }

        Arrays.sort(a);
        boolean s = true;
        for (int i = 0; i < a.length; i++) {
            if(i != a[i]){
                System.out.println(i);
                s = false;
                break;
            }
        }

        if(s) System.out.println(5);
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] a = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = scan.nextInt();
        }

        Arrays.sort(a);
        boolean s = true;
        for (int i = 0; i < a.length; i++) {
            if(i != a[i]){
                System.out.println(i);
                s = false;
                break;
            }
        }

        if(s) System.out.println(5);
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] a = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = scan.nextInt();
        }

        Arrays.sort(a);
        boolean s = true;
        for (int i = 0; i < a.length; i++) {
            if(i != a[i]){
                System.out.println(i);
                s = false;
                break;
            }
        }

        if(s) System.out.println(5);
    } main {
        Scanner scan = new Scanner(System.in);
        int[] a = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = scan.nextInt();
        }

        Arrays.sort(a);
        boolean s = true;
        for (int i = 0; i < a.length; i++) {
            if(i != a[i]){
                System.out.println(i);
                s = false;
                break;
            }
        }

        if(s) System.out.println(5);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int[] a = new int[5]; a new int[5] 5 for (int i = 0; i < 5; i++) {
            a[i] = scan.nextInt();
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            a[i] = scan.nextInt();
        } {
            a[i] = scan.nextInt();
        } a[i] = scan.nextInt() a[i] a i scan.nextInt() scan.nextInt scan Arrays.sort(a) Arrays.sort Arrays a boolean s = true; s true for (int i = 0; i < a.length; i++) {
            if(i != a[i]){
                System.out.println(i);
                s = false;
                break;
            }
        } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
            if(i != a[i]){
                System.out.println(i);
                s = false;
                break;
            }
        } {
            if(i != a[i]){
                System.out.println(i);
                s = false;
                break;
            }
        } if(i != a[i]){
                System.out.println(i);
                s = false;
                break;
            } i != a[i] i a[i] a i {
                System.out.println(i);
                s = false;
                break;
            } System.out.println(i) System.out.println System.out System System.out i s = false s false break; if(s) System.out.println(5); s System.out.println(5) System.out.println System.out System System.out 5 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] a = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = scan.nextInt();
        }

        Arrays.sort(a);
        boolean s = true;
        for (int i = 0; i < a.length; i++) {
            if(i != a[i]){
                System.out.println(i);
                s = false;
                break;
            }
        }

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

        Arrays.sort(a);
        boolean s = true;
        for (int i = 0; i < a.length; i++) {
            if(i != a[i]){
                System.out.println(i);
                s = false;
                break;
            }
        }

        if(s) System.out.println(5);
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] a = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = scan.nextInt();
        }

        Arrays.sort(a);
        boolean s = true;
        for (int i = 0; i < a.length; i++) {
            if(i != a[i]){
                System.out.println(i);
                s = false;
                break;
            }
        }

        if(s) System.out.println(5);
    }
}