Pair Sum with Python O(n) Given a list of n integers arr[0..(n-1)], determine the number of different pairs of elements…