n,s,a[1<<17];c(int*a,int*b){return*a-*b;}main(){for(;~scanf("%d",a+n++);*a=0);qsort(a+1,--n,4,c);for(;--n;a[n]-a[n+1]&&a[n+1]-a[n+2]&&s++);s=!printf("%d",s);}