#include <bits/stdc++.h>
using namespace std;
long long inf = numeric_limits<long long>::max();
long long solve(long long l1, long long r1, long long l2, long long r2, int k);
int main() {
  long long l1, r1, l2, r2;
  cin >> l1 >> r1 >> l2 >> r2;
  cout << solve(l1, r1, l2, r2, 30);
  return 0;
}
long long solve(long long l1, long long r1, long long l2, long long r2, int k) {
  if (l1 > r1 || l2 > r2) {
    return 0;
  }
  if (k == 1) {
    return 1;
  }
  long long res = max(min(r1, r2) - max(l1, l2) + 1, (long long)0);
  long long mid = (1 << k) / 2;
  if (max(r1, r2) < mid) return solve(l1, r1, l2, r2, k - 1);
  if (min(l1, l2) > mid)
    return solve(l1 - mid, r1 - mid, l2 - mid, r2 - mid, k - 1);
  if (res > r1 - l1 || res > r2 - l2) return res;
  if (l1 <= mid && r1 >= mid) {
    if (l2 <= mid && r2 >= mid) {
      res = max(res, solve(l1, mid - 1, 1, r2 % mid, k - 1));
      res = max(res, solve(1, r1 % mid, l2, mid - 1, k - 1));
    } else {
      res = max(res, solve(l1, mid - 1, l2 % mid, r2 % mid, k - 1));
      res = max(res, solve(1, r1 % mid, l2 % mid, r2 % mid, k - 1));
    }
  } else if (l2 <= mid && r2 >= mid) {
    res = max(res, solve(l1 % mid, r1 % mid, l2, mid - 1, k - 1));
    res = max(res, solve(l1 % mid, r1 % mid, 1, r2 % mid, k - 1));
  } else {
    res = max(res, solve(l1 % mid, r1 % mid, l2 % mid, r2 % mid, k - 1));
  }
  return res;
}
