Rajat eats a lot. Today he has been given N berries to eat. His mouth is so big that he can eat a lot of them together but quantity of berries should be a perfect square. Now picking berries and eating them requires 1 unit of energy. You have to calculate minimum energy he should spend so as to eat all the berries.
Constraints
1 ≤ N ≤ 10^5
An optimal solution is taking square of 3 and square of 1 berries which costs 2 operations as 10 = 9 + 1