# -*- coding: utf-8 -*- 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 == 5: print(5) else: print(min(ans*2, ans2*3))