Count Inversions Hackerrank Python Interview