func (ts *twosum) CountFast() int { is := sort.Insertion{ts.ids} is.Sort() ts.ids = is.A cnt := 0 for i, v := range ts.ids { bs := search.Binary{A: ts.ids, X: -v} index := bs.Recursive(0, len(bs.A)-1) if index > i { cnt += 1 } } return cnt }