Point Update Range Sum

For this question, can someone explain how do lines 15 to 17 find the number of inversions?

What language? \quad

Java, my bad, it basically uses only a BIT to solve the problem.

The solution basically queries the number of j such that j < i and a_j < a_i (number of not-inversions). It does this by updating the number of times each number has appeared in the input so far and then querying the prefix sum of that count array. It then subtracts the number of not-inversions from i to get the number of inversions.