def count_inversion(sequence):
    """
        Count inversions in a sequence of numbers
    """
    return sum(1 for x in range(len(sequence)) for y in range(x + 1, len(sequence)) if sequence[x] > sequence[y])