#include <bits/stdc++.h>
using namespace std;
namespace {
struct Complex {
  double x, y;
  Complex operator+(const Complex &b) const { return {x + b.x, y + b.y}; }
  Complex operator-(const Complex &b) const { return {x - b.x, y - b.y}; }
  Complex operator*(const Complex &b) const {
    return {x * b.x - y * b.y, x * b.y + y * b.x};
  }
  Complex MulR(double c) const { return {x * c, y * c}; }
  Complex MulI(double c) const { return {-y * c, x * c}; }
  Complex Conj(void) const { return {x, -y}; }
};
const int maxn = 1 << 21;
const double pi = acos(-1);
Complex root[maxn >> 1];
int rev[maxn];
void Init(int n) {
  rev[0] = 0;
  for (int i = 1; i < n; ++i) {
    rev[i] = i & 1 ? rev[i - 1] | n >> 1 : rev[i >> 1] >> 1;
  }
  for (int i = 0; i < n >> 1; ++i) {
    double alpha = 2 * pi * i / n;
    root[i] = {cos(alpha), sin(alpha)};
  }
}
void Dft(Complex *a, int n) {
  for (int i = 0; i < n; ++i) {
    if (i < rev[i]) {
      swap(a[i], a[rev[i]]);
    }
  }
  Complex *end = root + (n >> 1);
  for (int m = 1, step = n >> 1; m < n; m <<= 1, step >>= 1) {
    for (int i = 0; i < n; i += m << 1) {
      for (Complex *l = a + i, *r = l + m, *w = root; w < end; w += step) {
        Complex t = *r * *w;
        *r = *l - t;
        *l = *l + t;
        ++l;
        ++r;
      }
    }
  }
}
void Idft(Complex *a, int n) {
  reverse(a + 1, a + n);
  Dft(a, n);
  double inv = 1.0 / n;
  for (int i = 0; i < n; ++i) {
    a[i] = a[i].MulR(inv);
  }
}
}  // namespace
namespace {
void Transform(double &u, double &v, double &x, double &y) {
  double a = (u * u - v * v - x * x + y * y) * 0.25;
  u = x = (u * v + x * y) * 0.5;
  v = -a;
  y = a;
}
void Convolution(Complex *a, int n) {
  Init(n);
  Dft(a, n);
  for (int i = 0; i << 1 <= n; ++i) {
    int j = i ? n - i : 0;
    Transform(a[i].x, a[i].y, a[j].x, a[j].y);
  }
  Idft(a, n);
}
}  // namespace
const int maxlen = 1.5e6, base = 1e4;
int len;
vector<int> num, cur, tmp;
Complex com[maxn];
void GetMul(const vector<int> &a, const vector<int> &b, vector<int> &c) {
  int nn = 1;
  for (; nn < a.size() + b.size(); nn <<= 1)
    ;
  fill(com, com + nn, (Complex){0, 0});
  for (int i = 0; i < a.size(); ++i) {
    com[i].x = a[i];
  }
  for (int j = 0; j < b.size(); ++j) {
    com[j].y = b[j];
  }
  Convolution(com, nn);
  long long s = 0;
  c.clear();
  for (int i = 0; i < nn; ++i) {
    s += (long long)round(com[i].x);
    c.push_back(s % base);
    s /= base;
  }
  while (!c.empty() && c.back() == 0) {
    c.pop_back();
  }
}
void GetMul(const vector<int> &a, int b, vector<int> &c) {
  c.clear();
  long long s = 0;
  for (int i = 0; i < a.size() || s; ++i) {
    s += a[i] * b;
    c.push_back(s % base);
    s /= base;
  }
}
bool Less(const vector<int> &a, const vector<int> &b) {
  if (a.size() != b.size()) {
    return a.size() < b.size();
  }
  for (int i = (int)a.size() - 1; i >= 0; --i) {
    if (a[i] != b[i]) {
      return a[i] < b[i];
    }
  }
  return false;
}
void Read(vector<int> &a) {
  static char s[maxlen + 1];
  scanf("%s", s);
  len = strlen(s);
  a.clear();
  for (int r = len; r > 0; r -= 4) {
    int l = max(0, r - 4);
    int x = 0;
    for (int i = l; i < r; ++i) {
      x = 10 * x + s[i] - '0';
    }
    a.push_back(x);
  }
}
int main(void) {
  Read(num);
  int rest = floor(log(10) / log(3) * (len - 1));
  if (rest) {
    --rest;
  }
  int ans = rest * 3;
  tmp = {3};
  cur = {1};
  for (; rest; rest >>= 1) {
    if (rest & 1) GetMul(cur, tmp, cur);
    GetMul(tmp, tmp, tmp);
  }
  while (Less(cur, num)) {
    vector<int> t2, t3, t4;
    if (GetMul(cur, 2, t2), !Less(t2, num)) {
      ans += 2;
      break;
    } else if (GetMul(cur, 3, t3), !Less(t3, num)) {
      ans += 3;
      break;
    } else if (GetMul(cur, 4, t4), !Less(t4, num)) {
      ans += 4;
      break;
    } else {
      ans += 3;
      cur = t3;
    }
  }
  if (!ans) {
    ans = 1;
  }
  printf("%d\n", ans);
  return 0;
}
