P17737 [HackerEarth] 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 ber
普及-
题目描述

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

SAMPLE INPUT
10

SAMPLE OUTPUT
2

Explanation

An optimal solution is taking square of 3 and square of 1 berries which costs 2 operations as 10 = 9 + 1

输入格式

见题面

输出格式

见题面

样例输入
6766
样例输出
2