Link to the problem statement : https://cses.fi/problemset/task/1094
Please visit the link for the problem statement and then try it youself, and then go for the solution.
Please visit the link for the problem statement and then try it youself, and then go for the solution.