#include <bits/stdc++.h>
using namespace std;
int calc(int a, int b, int x, int y, int p) {
  if (a > b || x > y) return 0;
  a %= (2 * p);
  b %= (2 * p);
  x %= (2 * p);
  y %= (2 * p);
  if (a >= x && b <= y) return b - a + 1;
  if (x >= a && y <= b) return y - x + 1;
  int res = 0;
  if (a <= p && b >= p && x <= p && y >= p) res = min(b, y) - max(a, x) + 1;
  res = max(res, calc(a, min(b, p - 1), x, min(y, p - 1), p / 2));
  res = max(res, calc(a, min(b, p - 1), max(x, p + 1), y, p / 2));
  res = max(res, calc(max(a, p + 1), b, x, min(y, p - 1), p / 2));
  res = max(res, calc(max(a, p + 1), b, max(x, p + 1), y, p / 2));
  return res;
}
int main() {
  int la, ra, lb, rb;
  scanf("%d%d%d%d", &la, &ra, &lb, &rb);
  printf("%d\n", calc(la, ra, lb, rb, 1 << 30));
  return 0;
}
