#include <bits/stdc++.h>
using namespace std;
int a[4], b[4];
int main() {
  int i, x, y, d = -1, cnt, na, nb, cr, ret;
  scanf("%d %d", &x, &y);
  na = nb = 3;
  while (x > 0) {
    a[na] = x % 10;
    d = max(d, a[na]);
    x /= 10;
    na--;
  }
  while (y > 0) {
    b[nb] = y % 10;
    d = max(d, b[nb]);
    y /= 10;
    nb--;
  }
  d++;
  cr = ret = 0;
  for (i = 3; i > max(na, nb); i--) {
    cr += a[i] + b[i];
    cr /= d;
    ret++;
  }
  if (na == nb)
    ret += cr;
  else {
    if (na < nb) {
      for (; i > na; i--) {
        cr += a[i];
        cr /= d;
        ret++;
      }
    } else {
      for (; i > nb; i--) {
        cr += b[i];
        cr /= d;
        ret++;
      }
    }
    ret += cr;
  }
  printf("%d", ret);
  return 0;
}
