var a:array[1..100]of integer;i,n,k:integer;beginreadln(n);for i:=1 to n doreadln(a[i]);k:=0;for i:=1 to n do beginif a[i]=i then k:=k+1;end;writeln(k);end.
var a:array[1..100]of integer;i,n,k:integer;
begin
readln(n);
for i:=1 to n do
readln(a[i]);k:=0;
for i:=1 to n do begin
if a[i]=i then k:=k+1;end;
writeln(k);
end.