https://en.wikipedia.org/wiki/Order_statistic_tree (A persistent implementation can be built on top of fingertrees, see IndOrdSeq in https://github.com/aureooms/js-persistent)