n = int(input()) import sys if n == 1: print(1) exit() if n == 2: print(2) exit() j = 1 _min = n while 1 << j <= n: start = 2 end = n while end - start > 1: mid = (start + end) // 2 if mid ** j <= n: start = mid else: end = mid ans = start + j + n - start ** j if ans < _min: _min = ans j += 1 print(_min)