#include using ll = long long; using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); ll a;cin >> a; ll miku = 1; int ans = 0; while(miku < a){ ans++; miku *= 2; } ll miku2 = 1; int ans2 = 0; while(miku2 < a){ ans2++; miku2 *= 3; } cout << min(ans*2,ans2*3) << endl; return 0; }