An algorithm processes an input list of size n. It first performs an O(n log n) sorting operation. Then, for each element in the sorted list, it performs a nested loop iterating over all pairs of elements in the list. What is the overall time complexity of this algorithm?