#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> none = make_pair(-1, -1);
long long make_res(pair<long long, long long> a, pair<long long, long long> b,
                   long long bound) {
  return min(min(a.second, b.second), bound - 1) +
         min(min(a.first, b.first), bound - 1) + 1;
}
pair<pair<long long, long long>, pair<long long, long long> > check(
    long long l, long long r, long long rem, long long mod) {
  l += mod - rem;
  r += mod - rem;
  long long down = (l + mod - 1) / mod, up = r / mod;
  if (down > up) {
    return make_pair(none, none);
  } else if (down == up) {
    pair<long long, long long> all = make_pair(up * mod - l, r - up * mod);
    return make_pair(all, all);
  } else if (down + 1 == up) {
    return make_pair(make_pair(down * mod - l, mod - 1),
                     make_pair(mod - 1, r - up * mod));
  } else {
    pair<long long, long long> whole = make_pair(mod - 1, mod - 1);
    return make_pair(whole, whole);
  }
}
void show(pair<pair<long long, long long>, pair<long long, long long> > a) {
  printf("(%d, %d) or (%d, %d)\n", a.first.first, a.first.second,
         a.second.first, a.second.first);
}
int main() {
  long long l1, r1, l2, r2;
  scanf("%I64d%I64d%I64d%I64d", &l1, &r1, &l2, &r2);
  long long res = 0;
  for (int i = 0; i < 30; ++i) {
    pair<pair<long long, long long>, pair<long long, long long> > a =
        check(l1, r1, (1 << i), (1 << i) << 1);
    pair<pair<long long, long long>, pair<long long, long long> > b =
        check(l2, r2, (1 << i), (1 << i) << 1);
    res = max(res, make_res(a.first, b.first, (1 << i)));
    res = max(res, make_res(a.second, b.second, (1 << i)));
  }
  printf("%d\n", res);
}
