#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const double pi = 3.14159265358979323846264338327950288419716939937511;
const double eps = 1e-9;
char ch_ch_ch[1 << 20];
string gs() {
  scanf("%s", ch_ch_ch);
  return string(ch_ch_ch);
}
string gl() {
  gets(ch_ch_ch);
  return string(ch_ch_ch);
}
vector<pair<int, int> > a, b;
bool bound(pair<int, int> x, int v) {
  int t = (x.first + (1 << v) - 1) / (1 << v);
  return t * (1 << v) <= x.second;
}
int common(pair<int, int> a, pair<int, int> b, int c) {
  if (bound(a, c) && bound(b, c)) {
    int ta = (a.first + (1 << c) - 1) / (1 << c);
    ta *= (1 << c);
    int tb = (b.first + (1 << c) - 1) / (1 << c);
    tb *= (1 << c);
    return min(a.second - ta, b.second - tb) + min(ta - a.first, tb - b.first) +
           1;
  } else
    return 0;
}
void tear(pair<int, int> a, int c, vector<pair<int, int> > &v) {
  if (bound(a, c)) {
    int t = (a.first + (1 << c) - 1) / (1 << c);
    t *= (1 << c);
    if (t - 1 >= a.first) v.push_back(make_pair(a.first, t - 1));
    if (t + 1 <= a.second) v.push_back(make_pair(t + 1, a.second));
  } else
    v.push_back(a);
}
void solution() {
  int l1, r1, l2, r2;
  cin >> l1 >> r1 >> l2 >> r2;
  a.push_back(make_pair(l1, r1));
  b.push_back(make_pair(l2, r2));
  int res = 0;
  for (int c = 30; c >= 0; c--) {
    for (int i = 0; i < (a.size()); ++i)
      for (int j = 0; j < (b.size()); ++j)
        res = max(res, common(a[i], b[j], c));
    vector<pair<int, int> > tmp;
    for (int i = 0; i < (a.size()); ++i) tear(a[i], c, tmp);
    a.clear();
    if (tmp.size() >= 3)
      a.push_back(tmp[1]);
    else
      a = tmp;
    tmp.clear();
    for (int j = 0; j < (b.size()); ++j) tear(b[j], c, tmp);
    b.clear();
    if (tmp.size() >= 3)
      b.push_back(tmp[1]);
    else
      b = tmp;
  }
  cout << res << endl;
}
int main() {
  solution();
  return 0;
}
