#include <bits/stdc++.h>
using namespace std;
using cd = complex<double>;
using vi = vector<int>;
const double PI = acos(-1.0);
const int RADIX = 1000;
const int N = 1 << 19;
const double LOG_RADIX = log(RADIX);
const double LOG_3 = log(3.0);
istream& operator>>(istream& in, vi& r) {
  string s;
  in >> s;
  reverse((s).begin(), (s).end());
  while (int((s).size()) % 3) s += '0';
  r.resize(int((s).size()) / 3);
  for (decltype(0) i(0), _B_i(int((r).size())); i < _B_i; ++i)
    for (decltype(0) j(0), _B_j(3); j < _B_j; ++j)
      r[i] = r[i] * 10 + s[i * 3 + 2 - j] - '0';
  return in;
}
cd W[N];
template <bool Inv>
void fft(cd* p, int n) {
  for (int k = 1; k < n; k *= 2) {
    int m = n / (2 * k);
    for (decltype(0) l(0), _B_l(k); l < _B_l; ++l) {
      for (int i = 0, j = m; i < m; ++i, ++j) {
        cd x = p[i], y = p[j];
        p[i] = (x + y);
        p[j] = (x - y) * (Inv ? W[j] : conj(W[j]));
      }
      p += 2 * m;
    }
    p -= n;
  }
}
template <class first>
void bitrev(first* a, int n) {
  for (int i = 0, j = 0, k; i < n; ++i) {
    if (i < j) swap(a[i], a[j]);
    for (k = n; j & (k /= 2);)
      ;
    j += 3 * k - n;
  }
}
void sqr(vi& a) {
  int n = 2 * int((a).size()) - 1;
  for (; n & n - 1; n = (n | n - 1) + 1)
    ;
  vector<cd> af(n);
  for (decltype(0) i(0), _B_i(int((a).size())); i < _B_i; ++i) af[i] = a[i];
  fft<0>(af.data(), n);
  bitrev(af.data(), n);
  for (decltype(0) i(0), _B_i(n); i < _B_i; ++i) af[i] *= af[i];
  fft<1>(af.data(), n);
  bitrev(af.data(), n);
  const double invN = 1.0 / n;
  a.resize(n);
  int64_t carry = 0;
  for (decltype(0) i(0), _B_i(n); i < _B_i; ++i) {
    carry += (int64_t)(af[i].real() * invN + 0.5);
    a[i] = carry % RADIX;
    carry /= RADIX;
  }
  if (carry) a.push_back((int)carry);
  while (int((a).size()) && a.back() == 0) a.pop_back();
}
void mul(vi& a, int b) {
  int carry = 0;
  for (int& x : a) {
    carry += x * b;
    x = carry % RADIX;
    carry /= RADIX;
  }
  if (carry) a.push_back(carry);
}
int cmp(const vi& a, const vi& b) {
  if (int((a).size()) != int((b).size()))
    return int((a).size()) - int((b).size());
  for (int i = int((a).size()); i-- > 0;)
    if (a[i] != b[i]) return a[i] - b[i];
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  for (decltype(0) i(0), _B_i(N / 2); i < _B_i; ++i)
    W[i + N / 2] = polar(1.0, (2 * PI / N) * i);
  for (int i = N / 2; i-- > 0; W[i] = W[2 * i])
    ;
  vi a;
  cin >> a;
  int n = int((a).size());
  if (n == 1 && a[0] < 4) {
    cout << a[0] << endl;
    return 0;
  }
  double logA =
      n > 1 ? log(a[n - 1] * (double)RADIX + a[n - 2]) + LOG_RADIX * (n - 2)
            : log(a[n - 1]);
  int powerOf3 = max((int)(logA / LOG_3 - 1e-12) - 1, 0);
  int res = -1u / 2;
  vi x[3];
  x[0] = {1};
  for (int i = 30; i >= 0; --i) {
    sqr(x[0]);
    if (powerOf3 & 1 << i) mul(x[0], 3);
  }
  x[1] = x[0];
  mul(x[1], 4);
  mul(x[0], 3);
  x[2] = x[0];
  mul(x[2], 2);
  for (decltype(0) i(0), _B_i(3); i < _B_i; ++i) {
    int k = powerOf3 + 1;
    for (; cmp(x[i], a) < 0; ++k) {
      mul(x[i], 3);
    }
    res = min(res, 3 * k + i);
  }
  cout << res << endl;
  return 0;
}
