S=input().split(' ') for i in range(9): if(int(S[i])!=i+1): print(i+1) break