#include #define rep(i, n) for (int i = 1; i <= (n); i++) using namespace std; typedef long long ll; int main(){ vector b(10); rep(i, 9) cin >> b[i]; rep(i, 9){ if(b[i] != i){ cout << i << endl; return 0; } } return 0; }