Why not lock one segment, get the subcount, unlock, then move to next segment?
Here’s my take. Suppose 2 threads concurrently inserts an item in each of two segments. Before that, there are 33 items. Afterwards, there are 35 items. So 33 and 35 are both "correct" answers. 34 is incorrect.
If you lock one segment at a time, you could count an old value in one segment then a new value in another segment.