x = int(input()) b, t = 0, 0 while 2**b < x: b += 1 while 3**t < x: t += 1 print(min(2 * b, 3 * t))