#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, k, l, m, n, o;
  long long testcase;
  long long input, flag, tag, ans;
  long long a, b;
  long long dx[20][10];
  long long p[10];
  p[0] = 1;
  for (i = 1; i < 10; i++) {
    p[i] = 10 * p[i - 1];
  }
  for (i = 1; i <= 18; i++) {
    dx[i][0] = i;
    for (j = 1; j <= 8; j++) {
      dx[i][j] = p[j] * i;
      dx[i][j] += dx[i][j - 1];
    }
  }
  cin >> a >> b;
  long long sum = a + b;
  long long mx = -1;
  long long temp = a;
  while (temp) {
    mx = max(mx, temp % 10);
    temp /= 10;
  }
  temp = b;
  while (temp) {
    mx = max(mx, temp % 10);
    temp /= 10;
  }
  long long szmx = -1;
  for (i = 15; i >= mx; i--) {
    long long sz = 1;
    j = 0;
    while (1) {
      if (dx[i][j] >= sum) break;
      j++;
      sz++;
    }
    szmx = max(szmx, sz);
  }
  cout << szmx << endl;
}
