===== PascalABC.NET =====
begin
var n := ReadInteger('n=');
var a := ArrRandom(n, 1, n);
a.Println;
a.Where((v, i) -> v = i + 1).Count.Println
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
var
a: array[1..m] of integer;
i,n: integer;
begin
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do
if a[i]=i then writeln(i);
end.
===== PascalABC.NET =====
begin
var n := ReadInteger('n=');
var a := ArrRandom(n, 1, n);
a.Println;
a.Where((v, i) -> v = i + 1).Count.Println
end.