a = int(input()) for i in range(100): if 2**i >= a: break ans = 2*i for i in range(100): if 3**i >= a: ans = min(3*i,ans) break print(ans)