题目描述
All the players of Juventus Football Club live on a straight street. Their houses are numbered
0,1,2....N-1. One day, their coach decides to play a prank on them and sends each of them into
a particular house (they might even stay in their own house). No two friends will be sent to the
same house, obviously. Now every person would like to be in his own house. The coach allows them
to make exactly one swap. It is compulsory to make a swapThey'd like to know what is the maximum number of players who can be in
their own house after the swap.
Input:
N - Total number of players(2 ≤ N ≤ 10^6)
Next line has permutation of N integers (from 0 to N-1) where the ith number represents the house
where the ith player he has been transported to.
Output:
Output a single integer containing the maximum number of players who can be present in their own house.
Setter: Rivu Das
SAMPLE INPUT
3
0
2
1
SAMPLE OUTPUT
3
输入格式
见题面
输出格式
见题面