I'll show you how to find all elements in range using bounds. First, get lower_bound(v.begin(), v.end(), a) for the starting iterator of your range. Then get upper_bound(v.begin(), v.end(), b) for one past the last element in range.
The distance between these iterators equals the count of elements in your range. This pattern works for any range query on sorted data. You can also iterate between the bounds to process each element individually rather than just counting them.