#include <bits/stdc++.h>
template <class _, class __>
bool checkmax(_ &a, __ b) {
  return a < b ? a = b, true : false;
}
template <class _, class __>
bool checkmin(_ &a, __ b) {
  return a > b ? a = b, true : false;
}
using namespace std;
int solve(int l1, int r1, int l2, int r2, int k) {
  if (l1 > r1 || l2 > r2) return 0;
  if (l1 > l2) {
    swap(l1, l2);
    swap(r1, r2);
  }
  if (r2 <= r1) return r2 - l2 + 1;
  if (l1 == l2) return r1 - l1 + 1;
  int mid = 1 << k;
  if (r1 < mid && r2 < mid) return solve(l1, r1, l2, r2, k - 1);
  if (l2 > mid) return solve(l1, r1, l2 - mid, r2 - mid, k);
  return max(max(solve(l1, r1, l2, mid - 1, k), solve(l1, r1, 1, r2 - mid, k)),
             r1 - l2 + 1);
}
int l1, r1, l2, r2;
int main() {
  cin >> l1 >> r1 >> l2 >> r2;
  printf("%d\n", solve(l1, r1, l2, r2, 29));
  return EXIT_SUCCESS;
}
