import math def main(): a = int(input()) def f(n): return n * math.ceil(math.log(a, n)) ans = min(f(2), f(3)) print(ans) if __name__ == "__main__": main()