Problem E: 自由配对

Problem E: 自由配对

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MiB

Description

有 lns="http://www.w3.org/1998/Math/MathML">n 个人,编号分别为 lns="http://www.w3.org/1998/Math/MathML">1 到 lns="http://www.w3.org/1998/Math/MathML">n,我们需要将他们两两组队。每个人只愿意与另一个人组队,称之为他的组队对象。第 lns="http://www.w3.org/1998/Math/MathML">i 个人的组队对象记作 lns="http://www.w3.org/1998/Math/MathML">ai。只有当两人相互愿意与对方组队时,他们才能组成一个队伍。请问这些人可以组成多少个队伍。

Input

  • 第一行:一个整数 lns="http://www.w3.org/1998/Math/MathML">n
  • 第二行:lns="http://www.w3.org/1998/Math/MathML">n 个 整数 lns="http://www.w3.org/1998/Math/MathML">a1,a2,,an

  • 对于 lns="http://www.w3.org/1998/Math/MathML">30% 的数据,lns="http://www.w3.org/1998/Math/MathML">2n10
  • 对于 lns="http://www.w3.org/1998/Math/MathML">60% 的数据,lns="http://www.w3.org/1998/Math/MathML">2n1000
  • 对于lns="http://www.w3.org/1998/Math/MathML">100%的数据,lns="http://www.w3.org/1998/Math/MathML">2n100000
  • 数据保证 lns="http://www.w3.org/1998/Math/MathML">aii


Output

  • 单个整数,表示组队数量。

Sample Input Copy

4
3 3 2 1

Sample Output Copy

1

HINT

1号想和3号组队,
2号想和3号组队,
3号想和2号组队,
4号想和1号组队,
因此只有2号与3号可以组队。