N = int(input()) ans = 1 ans2 = 1 temp = 2 temp2 = 3 while temp <= N: ans += 1 temp *= 2 while temp2 <= N: ans2 += 1 temp2 *= 3 if N == 4: print(5) else: print(min(ans*2, ans2*3))