#include using namespace std; #define int long long typedef pair P; int INF = 1e16+7; int mod = 1e9+7; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; signed main() { int A; cin >> A; int N = A; int ans = INF; int cnt = 0; int pow = 1; while (true) { cnt++; if((N+1)/2 <= pow) { break; } pow*=2; } ans = min(ans,2*cnt); cnt = 0; pow = 1; N = A; while (true) { cnt++; if((A+2)/3 <= pow) { break; } pow*=3; } cout << min(ans,3*cnt) << endl; }