def    lowerCAmelCase_ (     __A							)     ->				List[Any]:







      '''simple docstring'''


      UpperCAmelCase__								=  0
      UpperCAmelCase__								=  len(__A							)

      for i in range(n - 1							):
            for j in range(i + 1,  __A							):
                  if arr[i] > arr[j]:
                        num_inversions += 1

      return num_inversions




def    lowerCAmelCase_ (     __A							)     ->				str:







      '''simple docstring'''


      if len(__A							) <= 1:
            return arr, 0
      UpperCAmelCase__								=  len(__A							) // 2
      UpperCAmelCase__								=  arr[0:mid]
      UpperCAmelCase__								=  arr[mid:]

      UpperCAmelCase__		,      UpperCAmelCase__								=  count_inversions_recursive(__A							)
      UpperCAmelCase__		,      UpperCAmelCase__								=  count_inversions_recursive(__A							)
      UpperCAmelCase__		,      UpperCAmelCase__								=  _count_cross_inversions(__A,  __A							)

      UpperCAmelCase__								=  inversion_p + inversions_q + cross_inversions
      return c, num_inversions




def    lowerCAmelCase_ (     __A,  __A							)     ->				List[Any]:







      '''simple docstring'''


      UpperCAmelCase__								=  []
      UpperCAmelCase__								=  UpperCAmelCase__								=  UpperCAmelCase__								=  0
      while i < len(__A							) and j < len(__A							):
            if p[i] > q[j]:
                  # if P[1] > Q[j], then P[k] > Q[k] for all  i < k <= len(P)
                  # These are all inversions. The claim emerges from the
                  # property that P is sorted.
                  num_inversion += len(__A							) - i
                  r.append(q[j]							)
                  j += 1
            else:
                  r.append(p[i]							)
                  i += 1

      if i < len(__A							):
            r.extend(p[i:]							)
      else:
            r.extend(q[j:]							)

      return r, num_inversion




def    lowerCAmelCase_ (     )     ->				List[str]:







      '''simple docstring'''


      UpperCAmelCase__								=  [10, 2, 1, 5, 5, 2, 11]

      # this arr has 8 inversions:
      # (10, 2), (10, 1), (10, 5), (10, 5), (10, 2), (2, 1), (5, 2), (5, 2)

      UpperCAmelCase__								=  count_inversions_bf(__A							)
      UpperCAmelCase__		,      UpperCAmelCase__								=  count_inversions_recursive(__A							)

      assert num_inversions_bf == num_inversions_recursive == 8

      print("number of inversions = ",  __A							)

      # testing an array with zero inversion (a sorted arr_1)

      arr_a.sort()
      UpperCAmelCase__								=  count_inversions_bf(__A							)
      UpperCAmelCase__		,      UpperCAmelCase__								=  count_inversions_recursive(__A							)

      assert num_inversions_bf == num_inversions_recursive == 0
      print("number of inversions = ",  __A							)

      # an empty list should also have zero inversions
      UpperCAmelCase__								=  []
      UpperCAmelCase__								=  count_inversions_bf(__A							)
      UpperCAmelCase__		,      UpperCAmelCase__								=  count_inversions_recursive(__A							)

      assert num_inversions_bf == num_inversions_recursive == 0
      print("number of inversions = ",  __A							)


if __name__ == "__main__":
      main()






"""simple docstring"""





from collections import defaultdict
from math import ceil, sqrt

def   __SCREAMING_SNAKE_CASE  (      A_ = 1_00_00_00						,     A_ = 10 ):
	lowerCAmelCase__	:						defaultdict  				=	defaultdict(A_ )

	for outer_width in range(3						,     (t_limit // 4) + 2 ):
		if outer_width * outer_width > t_limit:
			lowerCAmelCase__	:						int  				=	max(
			    ceil(sqrt(outer_width * outer_width - t_limit ) )						,     1 )
		else:
			lowerCAmelCase__	:						Tuple  				=	1

		hole_width_lower_bound += (outer_width - hole_width_lower_bound) % 2

		for hole_width in range(A_						,     outer_width - 1						,     2 ):
			count[outer_width * outer_width - hole_width * hole_width] += 1

	return sum(1 for n in count.values() if 1 <= n <= 10 )


if __name__ == "__main__":
							print(F'''{solution() = }''')




