#include <bits/stdc++.h>
using namespace std;
int contains(int a, int b, int val) {
  int multiplier = (1 << val);
  int coba = a / multiplier;
  while (coba * multiplier < a) ++coba;
  if (coba * multiplier > b) return -1;
  return coba * multiplier;
}
vector<pair<int, int> > split(int a, int b, int val) {
  int p1 = contains(a, b, val);
  vector<pair<int, int> > ret;
  if (p1 == -1) {
    ret.push_back(make_pair(a, b));
    return ret;
  }
  int p2 = contains(p1 + 1, b + 1, val);
  if (p2 == -1) {
    ret.push_back(make_pair(a, p1 - 1));
    ret.push_back(make_pair(p1 + 1, b));
    return ret;
  }
  ret.push_back(make_pair(p1 + 1, p2 - 1));
  return ret;
}
int calc(int a1, int b1, int a2, int b2, int val) {
  if (a1 > b1 || a2 > b2) return 0;
  assert(val >= 0);
  int c1 = contains(a1, b1, val);
  int c2 = contains(a2, b2, val);
  int ret = 0;
  if (c1 != -1 && c2 != -1) {
    int delta_a = c1 - a1;
    int delta_b = c2 - a2;
    int sebelum = min(delta_a, delta_b);
    int sesudah = min(b1 - c1, b2 - c2);
    ret = max((ret), (1 + sebelum + sesudah));
  }
  vector<pair<int, int> > s1 = split(a1, b1, val);
  vector<pair<int, int> > s2 = split(a2, b2, val);
  for (typeof((s1).begin()) i = (s1).begin(); i != (s1).end(); i++)
    for (typeof((s2).begin()) j = (s2).begin(); j != (s2).end(); j++)
      ret =
          max((ret), (calc(i->first, i->second, j->first, j->second, val - 1)));
  return ret;
}
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << calc(a, b, c, d, 30) << endl;
}
