#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000001;
const long double EPS = 1e-9;
const int MOD = 1000000007;
const long long LLINF = 1000000000000000001;
int middle(int c) { return (1 << (c - 1)); }
bool cmp(const pair<int, int> a, const pair<int, int> b) {
  if (a.first == b.first)
    return a.second > b.second;
  else
    return a.first < b.first;
}
vector<pair<int, int> > reduce_segments(vector<pair<int, int> > a) {
  sort((a).begin(), (a).end(), cmp);
  vector<pair<int, int> > r;
  int w = 0;
  for (auto i : a)
    if (i.second >= i.first && i.second > w) {
      w = i.second;
      r.push_back(i);
    }
  return r;
}
vector<pair<int, int> > cut_segments(vector<pair<int, int> > a, int k) {
  vector<pair<int, int> > r;
  for (auto i : a) {
    r.push_back(make_pair(i.first, min(middle(k) - 1, i.second)));
    r.push_back(make_pair(max(1, i.first - middle(k)), i.second - middle(k)));
  }
  return reduce_segments(r);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  vector<pair<int, int> > st(1), nd(1);
  cin >> st[0].first >> st[0].second >> nd[0].first >> nd[0].second;
  int ans = 0;
  for (int k = 30; k >= 1; k--) {
    for (auto i : st)
      for (auto j : nd)
        ans = max(ans, min(i.second, j.second) - max(i.first, j.first) + 1);
    st = cut_segments(st, k);
    nd = cut_segments(nd, k);
  }
  cout << ans << '\n';
}
