range of n is from 1 to 100000. You are testing zero and missing 100000. try this

int main(void)
{
int n;
int i = 1;
scanf("%d", &n);
int arr [100002];
int A=0;
for(i=1; i<=n; i++) { scanf("%d", &arr [i]); }
for(i=1;i<=n;i++)
if(arr[arr[i]]==i)
A++;
return 0;
}

The reason your code does not produce correct output is because the indexing of the array is 0-based, but the indexing of the permutation in the question is 1-based. For eg. the ith element of the permutation will be at the (i-1)th index in the array. The following code will suffice in this case: ideone.com/0rETn2

P.S- You need to remove the exclamation mark from “ambigous!” and put a ‘\n’ chararcter after each outut to get a write answer