#include <bits/stdc++.h>
using namespace std;
set<long long> used;
int main() {
  long long a, b, c;
  long long x, y, z;
  long long hc;
  long long sol, sag;
  long long res = 0;
  cin >> a >> b >> x >> y;
  for (int i = 30; i >= 0; i--) {
    hc = (1LL << i);
    c = (a / hc + 1) * hc;
    z = (x / hc + 1) * hc;
    if (a % hc == 0) c -= hc;
    if (x % hc == 0) z -= hc;
    if (z % (2LL << i) == 0) z += hc;
    if (c % (2LL << i) == 0) c += hc;
    for (long long l = 1, r = c; l <= 3 && r <= b; l++, r += hc * 2)
      for (long long j = 1, t = z; j <= 3 && t <= y; j++, t += hc * 2) {
        sol = (1LL << i) - 1LL;
        sol = min(sol, (r - a));
        sol = min(sol, (t - x));
        sag = (1LL << i) - 1LL;
        sag = min(sag, (b - r));
        sag = min(sag, (y - t));
        if (sol + sag + 1LL > res) {
          res = sol + sag + 1;
        }
      }
  }
  cout << res << endl;
  return 0;
}
