#import int n,t,x,m,a[10];main(){for(t=n=m=10;n--;)scanf("%d",a+n);for(;t--,x<3;m=10)for(;m--;x+=a[m]==t?1:0);printf("%d\n",t+1);}