#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long P = 7 * 17 << 23 | 1, G = 3;
const double pi = acos(-1.0);
const int N = 1 << 21 | 7;
const int base = 10;
int r[N], nl;
void fft(complex<double> *y, int len, int on) {
  int i, j, k, l = __builtin_ctz(len) - 1;
  complex<double> u, v, wn, w;
  if (nl != l)
    for (i = 0, nl = l; i < len; i++) r[i] = (r[i >> 1] >> 1) | ((i & 1) << l);
  for (i = 0; i < len; i++)
    if (i < r[i]) swap(y[i], y[r[i]]);
  for (i = 1; i < len; i <<= 1) {
    wn = exp(complex<double>(0, on * pi / i));
    for (j = 0; j < len; j += i << 1)
      for (k = j, w = 1; k < j + i; k++, w *= wn) {
        u = y[k], v = y[k + i] * w;
        y[k] = u + v, y[k + i] = u - v;
      }
  }
  if (on == -1)
    for (i = 0; i < len; i++) y[i] /= len;
}
complex<double> x[N], y[N];
void sqr(vector<int> &A) {
  int len = A.size() * 2;
  while (len & (len - 1)) len += len & -len;
  A.resize(len);
  int i, j;
  for (i = 0; i < len; i++) x[i] = complex<double>(A[i], A[i]);
  fft(x, len, 1);
  for (i = j = 0; i < len; i++, j = len - i)
    y[i] = (x[i] * x[i] - conj(x[j] * x[j])) * complex<double>(0, -0.25);
  fft(y, len, -1);
  A.push_back(0);
  for (i = 0; i < len; i++) A[i] = y[i].real() + 0.5;
  for (i = 0; i < len; i++)
    if (A[i] >= base) A[i + 1] += A[i] / base, A[i] %= base;
  while (!A.back()) A.pop_back();
}
void mul(vector<int> &A, int k) {
  int len = A.size(), i;
  A.push_back(0);
  for (i = 0; i < len; i++) A[i] *= k;
  for (i = 0; i < len; i++)
    if (A[i] >= base) A[i + 1] += A[i] / base, A[i] %= base;
  while (!A.back()) A.pop_back();
}
void divide(vector<int> &A, int k) {
  int len = A.size(), i;
  int temp = 0;
  for (int i = len - 1; ~i; i--) {
    (temp *= base) += A[i];
    A[i] = temp / k, temp %= k;
  }
  while (!A.back()) A.pop_back();
}
char num[N];
vector<int> a, b;
void getpow(int n) {
  if (n == 1) {
    a.clear();
    a.push_back(3);
    return;
  }
  getpow(n >> 1);
  sqr(a);
  if (n & 1) mul(a, 3);
}
inline bool les(vector<int> &A, vector<int> &B) {
  int la = A.size(), lb = B.size();
  if (la != lb) return la < lb;
  for (int i = la - 1; ~i; i--)
    if (A[i] != B[i]) return A[i] < B[i];
  return false;
}
int main() {
  scanf("%s", num);
  int l = strlen(num);
  if (l == 1 && num[0] - '0' <= 6) {
    int t = num[0] - '0';
    if (t <= 4)
      cout << t << '\n';
    else
      cout << 5 << '\n';
    return 0;
  }
  double t = 0;
  for (int i = 29; ~i; i--) (t *= 0.1) += num[i] & 15;
  int len = (log10(t) + l - 1) / log10(3);
  getpow(len);
  b.resize(l + 1);
  int cnt = 0, res = len * 3;
  for (int i = l - 1; i >= 0; i--) b[cnt++] = num[i] & 15;
  while (!b.back()) b.pop_back();
  while (les(a, b)) mul(a, 3), res += 3;
  cnt = 0;
  while (!les(a, b)) {
    cnt++;
    if (cnt % 3)
      mul(a, 2), divide(a, 3);
    else
      mul(a, 3), divide(a, 4);
    res--;
  }
  printf("%d\n", res + 1);
  return 0;
}
