#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int modExp(int a, int n, int p) {
  int ret = 1;
  for (; n; n >>= 1, a = 1LL * a * a % p)
    if (n & 1) ret = 1LL * ret * a % p;
  return ret;
}
namespace FFT {
const int M = 1 << 21;
const int P = 998244353;
int IM;
int a1[M], b1[M], p[M + 1], rev[M];
void NTT(int *B, int *A, int N, int D) {
  for (int j = 0, d = __builtin_ctz(M / N); j < N; j++) A[rev[j] >> d] = B[j];
  for (int n = 1, m = M / 2 * D; n < N; m /= 2, n <<= 1) {
    for (int i = 0; i < N; i += n << 1) {
      int *w = (D == 1 ? p : p + M), *a = A + i, *b = A + i + n;
      for (int j = 0; j < n; j++, a++, b++, w += m) {
        int x = 1LL * *w * *b % P;
        *b = (*a + P - x) % P;
        *a = (*a + x) % P;
      }
    }
  }
}
void init() {
  int fac[10] = {0}, n = 0;
  for (int Q = P - 1, q = 2; Q > 1; q++)
    if (Q % q == 0) {
      fac[n++] = q;
      while (Q % q == 0) Q /= q;
    }
  int G = 2;
  while (1) {
    int flg = 1;
    for (int i = 0; i < n; i++)
      if (modExp(G, P / fac[i], P) == 1) flg = 0;
    if (flg) break;
    G++;
  }
  G = modExp(G, P / M, P);
  for (int i = 0; i <= M; i++) p[i] = (i == 0 ? 1 : (LL)p[i - 1] * G % P);
  for (int i = 0, j = 1; j < M; j++) {
    for (int k = M >> 1; (i ^= k) < k; k >>= 1)
      ;
    rev[j] = i;
  }
  IM = modExp(M, P - 2, P);
}
void conv(int *a, int *b, int *c, int N, int P) {
  if (N <= 64) {
    static int temp[64];
    memset(temp, 0, sizeof(int) * N);
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N - i; j++) temp[i + j] = (temp[i + j] + a[i] * b[j]);
      for (int j = N - i; j < N; j++)
        temp[i + j - N] = (temp[i + j - N] + a[i] * b[j]);
    }
    memcpy(c, temp, sizeof(int) * N);
    return;
  }
  NTT(a, a1, N, 1);
  NTT(b, b1, N, 1);
  int R = IM * 1LL * M / N % P;
  for (int i = 0; i < N; i++) a1[i] = (LL)a1[i] * b1[i] % P * R % P;
  NTT(a1, c, N, -1);
}
void conv(int *a, int *b, int N, int P) {
  if (N <= 64) {
    static int temp[64];
    memset(temp, 0, sizeof(int) * N);
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N - i; j++)
        temp[i + j] = (temp[i + j] + 1LL * a[i] * a[j]);
      for (int j = N - i; j < N; j++)
        temp[i + j - N] = (temp[i + j - N] + 1LL * a[i] * a[j]);
    }
    memcpy(b, temp, sizeof(int) * N);
    return;
  }
  NTT(a, a1, N, 1);
  int R = modExp(N, P - 2, P);
  for (int i = 0; i < N; i++) a1[i] = (LL)a1[i] * a1[i] % P * R % P;
  NTT(a1, b, N, -1);
}
};  // namespace FFT
const int N = 1 << 21;
int a[N], b[N], an, bn;
void multiply() {
  for (int i = 0; i < bn; i++) b[i] *= 3;
  for (int i = 0; i < bn - 1; i++) {
    if (b[i] > 9) b[i + 1] += b[i] / 10, b[i] %= 10;
  }
  while (b[bn - 1] > 9) {
    b[bn] = b[bn - 1] / 10;
    b[bn - 1] %= 10;
    bn++;
  }
}
void newPow(int n) {
  if (n == 0) {
    bn = 1;
    b[0] = 1;
    return;
  }
  newPow(n / 2);
  int m = 32 - __builtin_clz(bn + bn - 1);
  m = 1 << m;
  FFT::conv(b, b, m, FFT::P);
  bn = bn + bn - 1;
  for (int i = 0; i < bn - 1; i++) {
    if (b[i] > 9) b[i + 1] += b[i] / 10, b[i] %= 10;
  }
  while (b[bn - 1] > 9) {
    b[bn] = b[bn - 1] / 10;
    b[bn - 1] %= 10;
    bn++;
  }
  if (n & 1) multiply();
}
void polyPow(int n) {
  an = 1, bn = 1;
  a[0] = 3, b[0] = 1;
  for (; n; n >>= 1) {
    if (n & 1) {
      int m = 32 - __builtin_clz(an + bn - 1);
      m = 1 << m;
      FFT::conv(a, b, b, m, FFT::P);
      bn = an + bn - 1;
      for (int i = 0; i < bn - 1; i++) {
        if (b[i] > 9) b[i + 1] += b[i] / 10, b[i] %= 10;
      }
      while (b[bn - 1] > 9) {
        b[bn] = b[bn - 1] / 10;
        b[bn - 1] %= 10;
        bn++;
      }
    }
    int m = 32 - __builtin_clz(an + an - 1);
    m = 1 << m;
    FFT::conv(a, a, m, FFT::P);
    an = an + an - 1;
    for (int i = 0; i < an - 1; i++) {
      if (a[i] > 9) a[i + 1] += a[i] / 10, a[i] %= 10;
    }
    while (a[an - 1] > 9) {
      a[an] = a[an - 1] / 10;
      a[an - 1] %= 10;
      an++;
    }
  }
}
string cur;
bool ok() {
  if (bn != cur.length()) return bn >= cur.length();
  for (int i = 0; i < cur.length(); i++) {
    if (cur[i] - '0' != b[bn - 1 - i]) return b[bn - 1 - i] >= cur[i] - '0';
  }
  return 1;
}
void divide() {
  vector<int> ret;
  int now = 0;
  for (int i = bn - 1; i >= 0; i--) {
    now = now * 10 + b[i];
    ret.push_back(now / 3);
    now = now % 3;
  }
  reverse(ret.begin(), ret.end());
  while (ret.back() == 0) ret.pop_back();
  bn = ret.size();
  for (int i = 0; i < bn; i++) b[i] = ret[i];
}
void multiply_2() {
  for (int i = 0; i < bn; i++) b[i] *= 2;
  for (int i = 0; i < bn - 1; i++) {
    if (b[i] > 9) b[i + 1] += b[i] / 10, b[i] %= 10;
  }
  while (b[bn - 1] > 9) {
    b[bn] = b[bn - 1] / 10;
    b[bn - 1] %= 10;
    bn++;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  FFT::init();
  cin >> cur;
  if (cur == "1") {
    cout << 1 << endl;
    return 0;
  }
  int len = cur.length() - 1;
  int x = (double)len / log(3) * log(10);
  newPow(x);
  while (!ok()) {
    multiply();
    x++;
  }
  int ans = x * 3;
  multiply_2();
  divide();
  if (ok()) ans = ans - 1;
  multiply_2();
  divide();
  if (ok()) ans = ans - 1;
  cout << ans << endl;
  return 0;
}
