Unable to understand this question?

unablre to understand the logic ?

@Nitya_Somani
refer this
(https://codeforces.com/blog/entry/46681)