select count(*) from ec_categories where sort_key = (:prev_sort_key + :next_sort_key)/2