#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int p, long long int m) {
  long long int ans = 1;
  long long int a_sqr = a;
  for (long long int k = p; k > 0; k /= 2) {
    if (k % 2) {
      ans *= a_sqr;
      ans %= m;
    }
    a_sqr *= a_sqr;
    a_sqr %= m;
  }
  return ans;
}
long long int inverse(long long int a, long long int m) {
  return power(a, m - 2, m);
}
constexpr int pack[][4] = {
    {167772161, 243, 1 << 25, 3},         {469762049, 2187, 1 << 26, 3},
    {998244353, 15311432, 1 << 23, 3},    {1107296257, 1087287097, 1 << 25, 10},
    {1711276033, 969788637, 1 << 25, 29}, {1811939329, 72705542, 1 << 26, 13},
    {2013265921, 440564289, 1 << 27, 31}, {2113929217, 1971140334, 1 << 25, 5}};
constexpr int usepacks[] = {1, 3};
template <int mod, int root, int root_pw>
void real_fft(vector<int>& v, bool invert) {
  int n = v.size();
  unsigned long long int a[n];
  for (int i = 0; i < n; i++) a[i] = v[i];
  for (int i = 1, j = 0; i < n; ++i) {
    int bit = n >> 1;
    for (; j >= bit; bit >>= 1) j ^= bit;
    j ^= bit;
    if (i < j) swap(a[i], a[j]);
  }
  unsigned long long int ww[n];
  unsigned long long int wi = invert ? inverse(root, mod) : root;
  for (int i = n; i < root_pw; i *= 2) wi = wi * wi % mod;
  unsigned long long int t = 1;
  for (int i = 0; i < n; i++) {
    ww[i] = t;
    t = (t * wi) % mod;
  }
  unsigned long long int opt = ((unsigned long long int)(-1)) / mod / mod - 1;
  unsigned long long int tt = 0;
  for (int len = 2; len <= n; len *= 2) {
    unsigned long long int k = n / len;
    for (int i = 0; i < n; i += len) {
      unsigned long long int wn = 0;
      for (int j = 0; j < len / 2; j++) {
        unsigned long long int u = a[i + j],
                               v = a[i + j + len / 2] * ww[wn] % mod;
        a[i + j] = u + v;
        a[i + j + len / 2] = u + mod - v;
        wn = wn + k;
      }
    }
    tt++;
    if (tt == opt) {
      for (int i = 0; i < n; i++)
        while (a[i] > mod) a[i] -= mod;
      tt = 0;
    }
  }
  if (tt)
    for (int i = 0; i < n; i++)
      while (a[i] > mod) a[i] -= mod;
  if (invert) {
    unsigned long long int nrev = inverse(n, mod);
    for (int i = 0; i < n; i++) a[i] = a[i] * nrev % mod;
  }
  for (int i = 0; i < n; i++) v[i] = a[i];
}
template <int n>
void fft(vector<int>& a, bool invert) {
  real_fft<pack[usepacks[n]][0], pack[usepacks[n]][1], pack[usepacks[n]][2]>(
      a, invert);
}
vector<int> multiply(const vector<int>& a, const vector<int>& b) {
  bool sqring = a.size() == b.size() ? a == b : 0;
  vector<int> fa = a, fa2, fb = b, fb2;
  int n = 1;
  while (n < (int)(a.size() + b.size())) n *= 2;
  fa.resize(n);
  fa2 = fa;
  fb.resize(n);
  fb2 = fb;
  int p1 = usepacks[0];
  int p2 = usepacks[1];
  long long int mod1 = pack[p1][0];
  long long int mod2 = pack[p2][0];
  fft<0>(fa, false);
  if (sqring)
    fb = fa;
  else
    fft<0>(fb, false);
  for (int i = 0; i < n; ++i) fa[i] = (fa[i] * 1LL * fb[i]) % mod1;
  fft<0>(fa, true);
  fft<1>(fa2, false);
  if (sqring)
    fb2 = fa2;
  else
    fft<1>(fb2, false);
  for (int i = 0; i < n; ++i) fa2[i] = (fa2[i] * 1LL * fb2[i]) % mod2;
  fft<1>(fa2, true);
  int r12 = inverse(mod1, mod2);
  vector<int> res;
  res.resize(n);
  long long int carry = 0;
  for (int i = 0; i < n; ++i) {
    long long int x1 = fa[i];
    long long int t = x1 % mod2;
    long long int x2 = ((fa2[i] + mod2 - t) * 1LL * r12) % mod2;
    carry = x1 + x2 * 1LL * mod1 + carry;
    res[i] = carry % 1000000;
    carry /= 1000000;
  }
  while (res.size() > 1 && !res.back()) res.pop_back();
  return res;
}
void small_mult(vector<int>& a, int b) {
  int carry = 0;
  for (int i = 0; i < (int)a.size() || carry; i++) {
    if (i == (int)a.size()) a.push_back(0);
    int cur = carry + a[i] * b;
    a[i] = cur % 1000000;
    carry = cur / 1000000;
  }
  while (a.size() > 1 && !a.back()) a.pop_back();
}
void fast_3_pow(int k, vector<int>& ans) {
  ans = {1};
  if (k <= 0) return;
  int r = 0, kk = 0;
  for (int t = k; t > 0; t /= 2) {
    r = (2 * r + t % 2);
    kk++;
  }
  for (int i = 0; i < kk; i++) {
    ans = multiply(ans, ans);
    if (r % 2) small_mult(ans, 3);
    r /= 2;
  }
}
bool first_is_BE(vector<int>& v1, vector<int>& v2) {
  if (v1.size() > v2.size()) return 1;
  if (v1.size() < v2.size()) return 0;
  for (int i = ((int)v1.size()) - 1; i >= 0; i--) {
    if (v1[i] > v2[i]) return 1;
    if (v1[i] < v2[i]) return 0;
  }
  return 1;
}
int main() {
  ios::sync_with_stdio(0);
  string s;
  cin >> s;
  int p = s.size();
  if (s == "1") {
    cout << "1";
    return 0;
  }
  if (s == "2") {
    cout << "2";
    return 0;
  }
  if (s == "3") {
    cout << "3";
    return 0;
  }
  if (s == "4") {
    cout << "4";
    return 0;
  }
  if (s == "5") {
    cout << "5";
    return 0;
  }
  if (s == "6") {
    cout << "5";
    return 0;
  }
  if (s == "7") {
    cout << "6";
    return 0;
  }
  if (s == "8") {
    cout << "6";
    return 0;
  }
  if (s == "9") {
    cout << "6";
    return 0;
  }
  vector<int> n;
  int tmp = 0;
  while (s.size() % 6 != 0) s = "0" + s;
  for (int i = 0; i < (int)s.size(); i++) {
    tmp *= 10;
    tmp += s[i] - '0';
    if ((i + 1) % 6 == 0) {
      n.push_back(tmp);
      tmp = 0;
    }
  }
  reverse(n.begin(), n.end());
  vector<int> v1, vt;
  int k;
  k = max((int)(p * logl(10) / logl(3) - 8), (int)0);
  fast_3_pow(k, v1);
  vt = v1;
  small_mult(v1, 4);
  while (1) {
    if (first_is_BE(v1, n)) {
      break;
    }
    k++;
    small_mult(v1, 3);
  }
  int ans3 = 3 * k + 4;
  k = max((int)(p * logl(10) / logl(3) - 8), (int)0);
  v1 = vt;
  while (1) {
    if (first_is_BE(v1, n)) {
      break;
    }
    k++;
    small_mult(v1, 3);
  }
  int ans1 = 3 * k;
  k = max((int)(p * logl(10) / logl(3) - 8), (int)0);
  v1 = vt;
  small_mult(v1, 2);
  while (1) {
    if (first_is_BE(v1, n)) {
      break;
    }
    k++;
    small_mult(v1, 3);
  }
  int ans2 = 3 * k + 2;
  cout << min(min(ans1, ans2), ans3);
  return 0;
}
