Added test cases for sort_and_count(a, lb, ub) method.