def remove_similar(items, n):
    """
    left only n items with same colour

    :param items: sorted by prediction
    :param n: number of similar to left
    :return: new list of items
    """
    cur_color = items[0]['prediction']
    count = 0
    new_items = []
    for item in items:
        if item['prediction'] != cur_color:
            cur_color = item['prediction']
            count = 0
        if count < n:
            count += 1
            new_items.append(item)
    return new_items