abc=[0]*4 a=list(map(int,input().split())) for i in a: abc[i]+=1 if abc.count(3)==1: print(a[0]) elif abc.count(2)==1: print(abc.index(1)) else: print(abc.index(0))