/**
 *  author:   TakeruOkuyama
 *  created:  2020-04-09 14:53:46
**/
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;

int main(){
    vector<int> B(9);
    rep(i, 9){
        cin >> B[i];
    }
    rep(i, 9){
        if(B[i] != i + 1){
            cout << i + 1 << endl;
            return 0;
        }
    }
return 0;}

/**
 * g++ code.cpp
 * ./a.out
 * shift + ctrl + i
**/