input: Write a Python function to determine how many elements in an array have their modular inverses equal to themselves under a given prime number p.
  assert mod_inverse_self([1, 6, 4, 5], 4, 7) == 2
  assert mod_inverse_self([1, 3, 8, 12, 12], 5, 13) == 3
  assert mod_inverse_self([2, 3, 4, 5], 4, 6) == 1
output: def mod_inverse_self(arr, n, p):
      def mod_inverse(a, p):
          return pow(a, p - 2, p)
      
      count = 0
      for x in arr:
          if x == mod_inverse(x, p):
              count += 1
      return count