use set, not binary search