'Find the point to partition n keys for a perfect binary search tree'

@staticmethod
def perfect_tree_pivot(n):

    x = 1
    x = (1 << (n.bit_length() - 1))
    if (((x // 2) - 1) <= (n - x)):
        return (x - 1)
    else:
        return (n - (x // 2))
