#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const int N = 1e3 + 10;
long long ans = 0;
bool isIn(long long o, long long l, long long r) { return l <= o && o <= r; }
pair<long long, long long> cross(long long l1, long long r1, long long l2,
                                 long long r2) {
  return {max(l1, l2), min(r1, r2)};
}
void refrain(long long o, long long l, long long r,
             vector<pair<long long, long long>> &v) {
  v.push_back(cross(1, o - 1, l, r));
  v.push_back(cross(1, o - 1, l - o, r - o));
}
void check(long long l1, long long r1, long long l2, long long r2,
           long long o) {
  if (r1 - l1 + 1 <= ans) return;
  if (r2 - l2 + 1 <= ans) return;
  if (isIn(o, l1, r1) && isIn(o, l2, r2)) {
    ans = max(ans, min(r1, r2) - max(l1, l2) + 1);
  }
  if (o == 1) return;
  vector<pair<long long, long long>> v1, v2;
  refrain(o, l1, r1, v1);
  refrain(o, l2, r2, v2);
  for (auto &p1 : v1) {
    for (auto &p2 : v2) {
      check(p1.first, p1.second, p2.first, p2.second, o >> 1);
    }
  }
}
int main() {
  long long l1, l2, r1, r2;
  cin >> l1 >> r1 >> l2 >> r2;
  check(l1, r1, l2, r2, 1 << 30);
  cout << ans << endl;
  return 0;
}
