#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> a[2][1000000];
map<pair<int, pair<int, int> >, bool> c;
int sz[2], f;
void chom(long long l, long long r, long long t) {
  if (l > r) {
    return;
  }
  if (c[make_pair(f, make_pair(l, r))] == 1) {
    return;
  }
  a[f][sz[f]++] = make_pair(l, r);
  c[make_pair(f, make_pair(l, r))] = 1;
  while (t > 1 && (t - 1) / 2 >= r) {
    t = (t - 1) / 2;
  }
  if (t >= 3) {
    t = (t - 1) / 2;
    chom(l, min(t, r), t);
    chom(max(l - t - 1, (long long)1), min(t, r - t - 1), t);
  }
}
int main() {
  long long l1, r1, l2, r2;
  cin >> l1 >> r1 >> l2 >> r2;
  f = 0;
  chom(l1, r1, ((long long)1 << 32));
  f = 1;
  chom(l2, r2, ((long long)1 << 32));
  long long jj = 0;
  for (int i = 0; i < sz[0]; i++)
    for (int j = 0; j < sz[1]; j++) {
      jj = max(jj, min(a[0][i].second, a[1][j].second) -
                       max(a[0][i].first, a[1][j].first) + 1);
    }
  cout << jj;
  return 0;
}
