list must be sorted