#include <bits/stdc++.h>
using namespace std;
const int N = 2000010, base = 1000;
const double pi = acos(-1);
int n;
char a[N];
struct E {
  double r, i;
  E(double _r = 0, double _i = 0) : r(_r), i(_i) {}
  friend E operator+(E a, E b) { return E(a.r + b.r, a.i + b.i); }
  friend E operator-(E a, E b) { return E(a.r - b.r, a.i - b.i); }
  friend E operator*(E a, E b) {
    return E(a.r * b.r - a.i * b.i, a.r * b.i + a.i * b.r);
  }
  friend E operator/(E a, double b) { return E(a.r / b, a.i / b); }
} w[2][N];
int num, rev[N];
inline void Pre(const int &n) {
  num = n;
  w[1][0] = w[0][0] = 1;
  for (int i = 1; i < n; i++)
    w[1][i] = E(cos(2 * pi * i / num), sin(2 * pi * i / num));
  for (int i = 1; i < n; i++) w[0][i] = w[1][num - i];
}
inline void FFT(E *a, int n, int r) {
  for (int i = 1; i < n; i++)
    if (rev[i] > i) swap(a[i], a[rev[i]]);
  for (int i = 1; i < n; i <<= 1)
    for (int j = 0; j < n; j += (i << 1))
      for (int k = 0; k < i; k++) {
        E x = a[j + k], y = a[j + k + i] * w[r][num / (i << 1) * k];
        a[j + k] = x + y;
        a[j + k + i] = x - y;
      }
  if (!r)
    for (int i = 0; i < n; i++) a[i] = a[i] / n;
}
int it[N], len;
long long tmp[N];
E A[N], B[N];
inline void mul(int *a, int lena, int *b, int lenb, int *c, int &lenc) {
  lenc = lena + lenb - 1;
  int m, L = 0;
  for (m = 1; m < lenc; m <<= 1, L++)
    ;
  m <<= 1;
  for (int i = 1; i < m; i++) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << L);
  for (int i = 0; i < lena; i++) A[i] = a[i + 1];
  for (int i = 0; i < lenb; i++) B[i] = b[i + 1];
  FFT(A, m, 1);
  FFT(B, m, 1);
  for (int i = 0; i < m; i++) A[i] = A[i] * B[i];
  FFT(A, m, 0);
  for (int i = 1; i <= lenc; i++) tmp[i] = (long long)(A[i - 1].r + 0.5);
  for (int i = 1; i <= lenc; i++)
    if (tmp[i] >= base) {
      if (i == lenc) tmp[++lenc] = 0;
      tmp[i + 1] += tmp[i] / base;
      tmp[i] %= base;
    }
  for (int i = 1; i <= lenc; i++) c[i] = tmp[i];
  for (int i = 0; i < m; i++) A[i] = B[i] = 0;
}
inline int sm(int *a, int lena, int *b, int lenb) {
  if (lena < lenb) return true;
  if (lena > lenb) return false;
  for (int i = lena; i; i--)
    if (a[i] > b[i])
      return false;
    else if (a[i] < b[i])
      return true;
  return false;
}
int ret[N], x[N], lena, lenb, cur[N], lenc;
int main() {
  scanf("%s", a + 1);
  n = strlen(a + 1);
  if (n == 1 && a[1] <= '5') return putchar(a[1]), 0;
  len = (n + 2) / 3;
  if (n % 3)
    for (int i = 1; i <= n % 3; i++) it[len] = it[len] * 10 + a[i] - '0';
  for (int i = 1; i <= n / 3; i++)
    for (int j = n % 3 + (i - 1) * 3 + 1; j <= n % 3 + i * 3; j++)
      it[n / 3 - i + 1] = it[n / 3 - i + 1] * 10 + a[j] - '0';
  int m;
  for (m = 1; m <= n / 3; m <<= 1)
    ;
  Pre(m <<= 1);
  int ans = 1 << 30;
  int p = (int)((n - 1) / log10(3) - log10(4) / log10(3));
  ret[lena = 1] = 1;
  x[lenb = 1] = 3;
  for (int y = p; y; y >>= 1) {
    if (y & 1) {
      mul(ret, lena, x, lenb, ret, lena);
    }
    if (y == 1) break;
    mul(x, lenb, x, lenb, x, lenb);
  }
  for (int t = 4, _t = 4; t; t /= 2, _t -= 2) {
    while (1) {
      lenc = lena;
      for (int i = 1; i <= lenc; i++) cur[i] = ret[i] * t;
      for (int i = 1; i <= lenc; i++)
        if (cur[i] >= base) {
          if (i == lenc) cur[++lenc] = 0;
          cur[i + 1] += cur[i] / base;
          cur[i] %= base;
        }
      if (!sm(cur, lenc, it, len)) break;
      p++;
      for (int i = 1; i <= lena; i++) ret[i] *= 3;
      for (int i = 1; i <= lena; i++) {
        if (ret[i] >= base) {
          if (i == lena) ret[++lena] = 0;
          ret[i + 1] += ret[i] / base;
          ret[i] %= base;
        }
      }
    }
    ans = min(ans, 3 * p + _t);
  }
  printf("%d\n", ans);
  return 0;
}
