#include <bits/stdc++.h>
using namespace std;
set<pair<pair<pair<int, int>, pair<int, int> >, int> > S;
int ans, pow2[31];
void swap(int &x, int &y) {
  int z = x;
  x = y;
  y = z;
}
int find(int l1, int r1, int l2, int r2) {
  if (l1 > l2) {
    swap(l1, l2);
    swap(r1, r2);
  }
  if (r1 < l2) return 0;
  return ((r1) < (r2) ? (r1) : (r2)) - ((l1) > (l2) ? (l1) : (l2)) + 1;
}
pair<int, int> p1, p2;
pair<pair<int, int>, pair<int, int> > p;
void rec(int n, int l1, int r1, int l2, int r2) {
  if (n == 0) {
    if (ans == 0) ans = 1;
    return;
  }
  p1 = make_pair(l1, r1), p2 = make_pair(l2, r2);
  p = make_pair(((p1) < (p2) ? (p1) : (p2)), ((p1) > (p2) ? (p1) : (p2)));
  if (S.find(make_pair(p, n)) != S.end()) return;
  S.insert(make_pair(p, n));
  int temp = find(l1, r1, l2, r2);
  if (temp > ans) ans = temp;
  int mid = pow2[n - 1];
  if (l1 < mid && l2 < mid)
    rec(n - 1, l1, ((r1) < (mid - 1) ? (r1) : (mid - 1)), l2,
        ((r2) < (mid - 1) ? (r2) : (mid - 1)));
  if (l1 < mid && r2 > mid)
    rec(n - 1, l1, ((r1) < (mid - 1) ? (r1) : (mid - 1)),
        ((l2 - mid) > (1) ? (l2 - mid) : (1)), r2 - mid);
  if (r1 > mid && l2 < mid)
    rec(n - 1, ((l1 - mid) > (1) ? (l1 - mid) : (1)), r1 - mid, l2,
        ((r2) < (mid - 1) ? (r2) : (mid - 1)));
  if (r1 > mid && r2 > mid)
    rec(n - 1, ((l1 - mid) > (1) ? (l1 - mid) : (1)), r1 - mid,
        ((l2 - mid) > (1) ? (l2 - mid) : (1)), r2 - mid);
}
int main() {
  int i, l1, r1, l2, r2;
  pow2[0] = 1;
  for (i = 1; i < 31; ++i) pow2[i] = pow2[i - 1] * 2;
  while (scanf("%d %d %d %d", &l1, &r1, &l2, &r2) != EOF) {
    ans = 0;
    S.clear();
    rec(30, l1, r1, l2, r2);
    printf("%d\n", ans);
  }
  return 0;
}
