#include #define INF 2000000000000000000 #define ll long long using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll A; cin >> A; ll ans = INF; for (ll i = 1; i <= 60; ++i) { if (A <= pow(2, i)) { ans = i * 2; break; } } for (ll i = 1; i <= 38; ++i) { if (A <= pow(3, i)) { ans = min(ans, i * 3); break; } } cout << ans << "\n"; }