#include <bits/stdc++.h>
using namespace std;
void Ios() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  return;
}
long long int pl(long long int x, long long int l, long long int r) {
  long long int pos = (l - x) / (x << 1) * (x << 1) + x;
  while (pos < l) pos += x << 1;
  while (pos - (x << 1) >= l) pos -= x << 1;
  return pos;
}
long long int pr(long long int x, long long int l, long long int r) {
  long long int pos = (r - x) / (x << 1) * (x << 1) + x;
  while (pos > r) pos -= x << 1;
  while (pos + (x << 1) <= r) pos += x << 1;
  return pos;
}
pair<long long int, long long int> countl(long long int x, long long int l,
                                          long long int r) {
  long long int pos = pl(x, l, r);
  if (l <= pos && pos <= r)
    return make_pair(min(pos - l, x - 1), min(r - pos, x - 1));
  else
    return make_pair(-1, -1);
}
pair<long long int, long long int> countr(long long int x, long long int l,
                                          long long int r) {
  long long int pos = pr(x, l, r);
  if (l <= pos && pos <= r)
    return make_pair(min(pos - l, x - 1), min(r - pos, x - 1));
  else
    return make_pair(-1, -1);
}
pair<long long int, long long int> countm(long long int x, long long int l,
                                          long long int r) {
  long long int posl = pl(x, l, r), posr = pr(x, l, r);
  if (l <= posl && posl <= r && l <= posr && posr <= r &&
      posr - posl >= (x << 2))
    return make_pair(x - 1, x - 1);
  else
    return make_pair(-1, -1);
}
int main() {
  int l1, r1, l2, r2;
  long long int ans = 0;
  scanf("%d%d%d%d", &l1, &r1, &l2, &r2);
  for (int i = (1 << 30); i > 0; i >>= 1) {
    vector<pair<long long int, long long int>> v1, v2;
    v1.push_back(countl(i, l1, r1));
    v1.push_back(countm(i, l1, r1));
    v1.push_back(countr(i, l1, r1));
    v2.push_back(countl(i, l2, r2));
    v2.push_back(countm(i, l2, r2));
    v2.push_back(countr(i, l2, r2));
    for (pair<long long int, long long int> j : v1)
      for (pair<long long int, long long int> k : v2)
        if (j.first >= 0 && k.first >= 0) {
          ans = max(ans, min(j.first, k.first) + min(j.second, k.second) + 1);
        }
  }
  printf("%lld\n", ans);
}
