Solution for dromoi in O(nlog)