Count Inversions Hackerrank Python Problem