output_description: Print the number of the friendly pairs.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      N
      a_1 a_2 ... a_N
attempt: N = int(input())
  aa = input()
  b = []
  b = aa.split(" ")
  output = 0
  a = []
  flag = []
  for i in range(len(b)):
      a.append(int(b[i]))
      flag.append(False)
  
  for i in range(len(a)):
      if i + 1 == a[a[i] - 1]:
          output = output + 1
  
  
  print(output // 2)
  
problem_description: Statement
  
  There are N rabbits, numbered 1 through N.
  
  The i-th (1≤i≤N) rabbit likes rabbit a_i. Note that no rabbit can like itself,
  that is, a_i≠i.
  
  For a pair of rabbits i and j (i＜j), we call the pair (i，j) a _friendly pair_
  if the following condition is met.
  
    * Rabbit i likes rabbit j and rabbit j likes rabbit i.
  
  Calculate the number of the friendly pairs.
samples: [{"input": "4\n    2 1 4 3", "output": "2\n    \n\nThere are two friendly pairs: (1\uff0c2) and (3\uff0c4).\n\n* * *"}, {"input": "3\n    2 3 1", "output": "0\n    \n\nThere are no friendly pairs.\n\n* * *"}, {"input": "5\n    5 5 5 5 1", "output": "1\n    \n\nThere is one friendly pair: (1\uff0c5)."}]