#include <bits/stdc++.h>
using namespace std;
long long common(long long a, long long b, long long c, long long d) {
  long long high = min(b, d);
  long long low = max(a, c);
  if (low > high) return 0;
  return high - low + 1;
}
vector<pair<long long, long long> > func(long long a, long long b,
                                         long long two) {
  if (a % two == 0) a++;
  if (b % two == 0) b--;
  vector<pair<long long, long long> > v;
  if (a > b) return v;
  if (a / two == b / two) {
    v.push_back(make_pair(a, b));
  } else {
    v.push_back(make_pair(a, (a / two) * two + two - 1));
    v.push_back(make_pair((b / two) * two + 1, b));
    if (a / two + 1 < b / two) v.push_back(make_pair(1ll, two - 1));
  }
  int i;
  for ((i) = 0; (i) < (int)(v.size()); (i)++) {
    v[i].first %= two;
    v[i].second %= two;
  }
  return v;
}
long long fast(long long a, long long b, long long c, long long d) {
  long long ans = 0;
  long long two = 1;
  int i, j, k;
  for ((i) = 0; (i) < (int)(30); (i)++) {
    two *= 2;
    vector<pair<long long, long long> > v1 = func(a, b, two);
    vector<pair<long long, long long> > v2 = func(c, d, two);
    for ((j) = 0; (j) < (int)(v1.size()); (j)++)
      for ((k) = 0; (k) < (int)(v2.size()); (k)++) {
        long long tmp =
            common(v1[j].first, v1[j].second, v2[k].first, v2[k].second);
        ans = max(ans, tmp);
      }
  }
  return ans;
}
int main(void) {
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << fast(a, b, c, d) << endl;
  return 0;
}
