#include <bits/stdc++.h>
int main() {
  int base;
  int a, b;
  int x, y;
  int s;
  int now;
  int ans;
  int mark;
  scanf("%d %d", &x, &y);
  a = x;
  b = y;
  base = 0;
  while (a) {
    now = a % 10;
    if (now > base) base = now;
    a /= 10;
  }
  while (b) {
    now = b % 10;
    if (now > base) base = now;
    b /= 10;
  }
  base++;
  ans = 0;
  mark = 0;
  while (x || y) {
    ans++;
    mark += x % 10;
    mark += y % 10;
    x /= 10;
    y /= 10;
    mark /= base;
  }
  printf("%d\n", ans + mark);
  return 0;
}
