#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
template <class C>
inline void mini(C& a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
inline void maxi(C& a4, C b4) {
  a4 = max(a4, b4);
}
int res;
set<vector<int> > M;
void go(int l1, int r1, int l2, int r2) {
  if (r1 < l1 || r2 < l2) return;
  vector<int> v;
  v.push_back(l1);
  v.push_back(r1);
  v.push_back(l2);
  v.push_back(r2);
  if (M.count(v)) return;
  M.insert(v);
  if (min(r1 - l1 + 1, r2 - l2 + 1) <= res) return;
  int n = 30;
  while ((1 << n) > max(r1, r2)) n--;
  int p = 1 << n;
  if (l1 <= p && p <= r1 && l2 <= p && p <= r2)
    maxi(res, p - max(l1, l2) + min(r1, r2) - p + 1);
  if (l1 > p) {
    go(l1 - p, r1 - p, l2, r2);
    return;
  }
  if (l2 > p) {
    go(l1, r1, l2 - p, r2 - p);
    return;
  }
  if (l1 <= p && p <= r1) {
    go(l1, p - 1, l2, r2);
    go(1, r1 - p, l2, r2);
    return;
  }
  if (l2 <= p && p <= r2) {
    go(l1, r1, l2, p - 1);
    go(l1, r1, 1, r2 - p);
    return;
  }
}
int main() {
  std::ios_base::sync_with_stdio(0);
  cout << setprecision(15) << fixed;
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  go(a, b, c, d);
  cout << res << endl;
  return 0;
}
