#include <bits/stdc++.h>
using namespace std;
long long a, b, ans, sum, num, start, fst, sec, sz;
vector<long long> myvec, newvec, v1;
void count(long long xs) {
  sz = 0;
  v1.clear();
  while (xs) {
    start = max(start, xs % 10);
    v1.push_back(xs % 10);
    xs /= 10;
    sz++;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> a >> b;
  count(a);
  fst = sz, myvec = v1;
  count(b);
  sec = sz, newvec = v1;
  ++start;
  for (long long i = 1; i <= 10; i++) {
    myvec.push_back(0);
    newvec.push_back(0);
  }
  for (long long i = start; i <= 1000; i++) {
    sum = num = 0;
    while (sum < sec || sum < fst || num) {
      num += (myvec[sum] + newvec[sum]);
      num /= i;
      sum++;
    }
    ans = max(ans, sum);
  }
  cout << ans << "\n";
  return 0;
}
