In the module “More operations on ordered sets”, it’s mentioned that a multiset count() operation takes time **linear** in the number of matches.

Is it possible to count the number of elements in logarithmic time using the following code?

```
multiset<int> ms;
int x; cin >> x;
int ub = ms.upper_bound(x) - ms.begin();
int lb = ms.lower_bound(x) - ms.begin();
cout << ub - lb << '\n';
```

In particular, is it allowed to subtract two iterators?