def count_inversions(array, blank):
    """Returns the number of inversions in a list ignoring the blank value."""
    count = 0
    for i, tile1 in enumerate(array[:-1]):
        if tile1 is not blank:
            for tile2 in array[i + 1 :]:
                if tile2 is not blank:
                    if tile1 > tile2:
                        count += 1
    return count