{ tde } {$APPTYPE CONSOLE} {$B-,R-,O+} const maxn=1000; var fi,fo:text; n,i,tek,groups:smallint; f:array[0..maxn] of smallint; begin assign(fi,'liars.dat'); assign(fo,'liars.sol'); reset(fi); rewrite(fo); readln(fi,n); fillchar(f,sizeof(f),0); for i:=1 to n do begin read(fi,tek); f[tek]:=f[tek]+1; end; groups:=0; for i:=1 to n do if(f[i]=i)then groups:=groups+1;; if(groups=1)then writeln(fo,0) else writeln(fo,groups); close(fi); close(fo); end.