#include <bits/stdc++.h>
using namespace std;
const int K = 21, N = 1 << K;
struct cmp {
  double x, y;
  cmp(double _x = 0, double _y = 0) : x(_x), y(_y) {}
};
inline cmp operator+(cmp a, cmp b) { return cmp(a.x + b.x, a.y + b.y); }
inline cmp operator-(cmp a, cmp b) { return cmp(a.x - b.x, a.y - b.y); }
inline cmp operator*(cmp a, cmp b) {
  return cmp(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
}
inline cmp conj(cmp a) { return cmp(a.x, -a.y); }
string n;
int p, ans;
cmp poW[N], f[N];
int rev[N], nd, num[N], td, tgt[N];
void init() {
  poW[0] = cmp(1, 0);
  double a1 = 8 * atan(1) / N;
  for (int i = 1; i < N; i++) {
    double a = a1 * i;
    poW[i] = cmp(cos(a), sin(a));
    rev[i] = (i & 1) << K - 1 | rev[i >> 1] >> 1;
  }
}
void mul(int x) {
  int car = 0;
  for (int i = 0; i < nd; i++) {
    car += num[i] * x;
    num[i] = car % 10;
    car /= 10;
  }
  while (car) {
    num[nd++] = car % 10;
    car /= 10;
  }
}
void div(int x) {
  int rem = 0;
  for (int i = nd - 1; i >= 0; i--) {
    rem = rem * 10 + num[i];
    num[i] = rem / x;
    rem %= x;
  }
  assert(rem == 0);
  while (nd && !num[nd - 1]) {
    nd--;
  }
}
void fft(int k) {
  int n = 1 << k, sh = K - k;
  for (int i = 0; i < n; i++) {
    int j = rev[i] >> sh;
    if (i < j) swap(f[i], f[j]);
  }
  for (int k = 1, sh = K - 1; k < n; k <<= 1, sh--) {
    for (int i = 0; i < n; i += k << 1) {
      for (int j = 0; j < k; j++) {
        int l = i + j, r = l + k;
        cmp z = f[r] * poW[j << sh];
        f[r] = f[l] - z;
        f[l] = f[l] + z;
      }
    }
  }
}
void pow3(int x) {
  nd = num[0] = 1;
  for (int k = 0, n = 1, b = K; b >= 0; b--) {
    for (nd <<= 1; n < nd; k++, n <<= 1)
      ;
    for (int i = 0; i < n; i++) {
      f[i] = cmp(num[i], 0);
    }
    fft(k);
    for (int i = 0; i < n; i++) {
      f[i] = f[i] * f[i];
      f[i].y = -f[i].y;
    }
    fft(k);
    for (int i = 0; i < n; i++) {
      num[i] = f[i].x / n + 0.5;
    }
    for (; nd && !num[nd - 1]; nd--)
      ;
    mul(1);
    if (x >> b & 1) mul(3);
  }
}
bool small() {
  for (int i = max(nd, td) - 1; i >= 0; i--) {
    if (num[i] < tgt[i]) return true;
    if (num[i] > tgt[i]) return false;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  init();
  cin >> n;
  if (n == "1") {
    cout << 1 << '\n';
    return 0;
  }
  td = n.length();
  for (int i = 0; i < td; i++) {
    tgt[i] = n[td - 1 - i] - '0';
  }
  pow3(p = max(td / log10(3.0L) - 3.5L, 0.0L));
  ans = p * 3;
  while (small()) {
    if (ans <= 3) {
      num[0] = ans + 1;
    } else if (ans % 3 == 0) {
      div(3);
      mul(4);
    } else {
      div(2);
      mul(3);
    }
    ans++;
  }
  cout << ans << '\n';
}
