def main(): A = int(input()) i = 0 while True: i += 1 tmp = 2**i if tmp >= A: break ans2 = 2*i j = 0 while True: j += 1 tmp = 3**j if tmp >= A: break ans3 = 3*j #print(ans2,ans3) ans = min(ans2,ans3) return ans print(main())