import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) A = int(input()) cnt = 1 two = 2 three = 3 ans = 10**20 while 1: two = 2**cnt three = 3**cnt if two>=A: ans = min(ans, 2*cnt) if three>=A: ans = min(ans, 3*cnt) cnt += 1 if two>=A and three>=A: break print(ans)