def get_max_displacement(permutation):
    """Returns the maximum absolute difference between each value and its index
    in a permutation."""
    return max(abs(i - permutation[i]) for i in range(len(permutation)))