#include <bits/stdc++.h>
using namespace std;
int Go(int l1, int r1, int l2, int r2, int step) {
  if (l1 <= l2 && r2 <= r1) return r2 - l2 + 1;
  if (l2 <= l1 && r1 <= r2) return r1 - l1 + 1;
  if (step == 1) return 1;
  int mid = 1 << step;
  if (l1 == mid) l1++;
  if (r1 == mid) r1--;
  if (l2 == mid) l2++;
  if (r2 == mid) r2--;
  if (l1 > r1 || l2 > r2) return 0;
  vector<pair<int, int> > a, b;
  if (l1 < mid) a.push_back(make_pair(l1, min(r1, mid - 1)));
  if (r1 > mid) a.push_back(make_pair(max(1, l1 - mid), r1 - mid));
  if (l2 < mid) b.push_back(make_pair(l2, min(r2, mid - 1)));
  if (r2 > mid) b.push_back(make_pair(max(1, l2 - mid), r2 - mid));
  int ret = 0;
  if (max(l1, l2) <= min(r1, r2)) ret = min(r1, r2) - max(l1, l2) + 1;
  for (int i = 0; i < a.size(); i++)
    for (int j = 0; j < b.size(); j++)
      ret = max(ret,
                Go(a[i].first, a[i].second, b[j].first, b[j].second, step - 1));
  return ret;
}
int main() {
  int l1, r1, l2, r2;
  cin >> l1 >> r1 >> l2 >> r2;
  int res = Go(l1, r1, l2, r2, 30);
  cout << res << endl;
  return 0;
}
