#include <bits/stdc++.h>
using namespace std;
int go(int a, int b, int c, int d, int l) {
  int p = (1 << l);
  if (a > c || (a == c && b > d)) return go(c, d, a, b, l);
  if (b >= d) return d - c + 1;
  if (a == c) return b - a + 1;
  if (a > p) return go(a - p, b - p, c - p, d - p, l - 1);
  if (c > p) return go(a, b, c - p, d - p, l);
  if (d < p) return go(a, b, c, d, l - 1);
  if (b < p) return max(go(a, b, c, p - 1, l - 1), go(a, b, 1, d - p, l - 1));
  return max(b - c + 1, go(a, p - 1, 1, d - p, l - 1));
}
int main() {
  int a, b, c, d;
  while (scanf("%d%d%d%d", &a, &b, &c, &d) == 4) {
    if (a > c || (a == c && b > d)) swap(a, c), swap(b, d);
    printf("%d\n", go(a, b, c, d, 30));
  }
  return 0;
}
