l[7],i;main(n){for(;~scanf("%d",&i);n=0)l[i&7]+=!n;for(i=7;i--;n=l[i]>l[n]?i:n);n=!printf("%d",n);}