def get_breakpoints(index_list):
    """
    Traverses a given list (index_list) of indices and generates a new list (breakpoints) of the same length.
    If an element in index_list differs from its preceding element, it sets the corresponding element in
    breakpoints to 1, otherwise 0.
    :param index_list: List of numbers
    :return: list of 0 and 1
    """
    breakpoints = [0] * len(index_list)
    for i in range(1, len(index_list)):
        if index_list[i] != index_list[i-1]:
            breakpoints[i] = 1

    return breakpoints