#include <bits/stdc++.h>
using namespace std;
long long L, R;
vector<pair<long long, long long> > itvs[40];
long long len(int s) { return (1LL << s) - 1; }
void search(long long l, long long r, int s) {
  if (R <= l || r <= L) return;
  if (L <= l && r <= R) {
    for (int i = 1; i <= s; ++i) itvs[i].push_back(make_pair(0, len(i)));
    return;
  }
  int c = (l + r) / 2;
  if (L <= c && c <= R) {
    long long tl = max(l, L) % (1LL << s);
    long long tr = min(r, R) % (1LL << s);
    itvs[s].push_back(make_pair(tl, tr));
  }
  search(l, c, s - 1);
  search(c + 1, r, s - 1);
}
long long L1, R1, L2, R2;
vector<pair<long long, long long> > itvs1[40], itvs2[40];
int main() {
  while (cin >> L1 >> R1 >> L2 >> R2) {
    --L1;
    --L2;
    {
      L = L1;
      R = R1;
      for (int i = 1; i <= 30; ++i) itvs[i].clear();
      search(0, len(30), 30);
      for (int i = 1; i <= 30; ++i) itvs1[i] = itvs[i];
    }
    {
      L = L2;
      R = R2;
      for (int i = 1; i <= 30; ++i) itvs[i].clear();
      search(0, len(30), 30);
      for (int i = 1; i <= 30; ++i) itvs2[i] = itvs[i];
    }
    long long ans = 0;
    for (int i = 1; i <= 30; ++i) {
      for (int j1 = 0; j1 < (int)(itvs1[i].size()); j1++) {
        for (int j2 = 0; j2 < (int)(itvs2[i].size()); j2++) {
          pair<long long, long long> t1 = itvs1[i][j1];
          pair<long long, long long> t2 = itvs2[i][j2];
          long long x = min(t1.second, t2.second) - max(t1.first, t2.first);
          ans = max(ans, x);
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
