#include <bits/stdc++.h>
using namespace std;
int l1, r1, l2, r2;
void ReadInput() { cin >> l1 >> r1 >> l2 >> r2; }
int solve(int l, int r, int L, int R, int k) {
  if (l > r || L > R) return 0;
  if (r == R) return r - max(l, L) + 1;
  if (l == L) return min(r, R) - l + 1;
  if (k == 1) return 1;
  int res = max(0, min(r, R) - max(l, L) + 1);
  int mid = (1 << (k - 1));
  res = max(res, solve(l, min(mid - 1, r), L, min(mid - 1, R), k - 1));
  res = max(res,
            solve(l, min(mid - 1, r), max(L, mid + 1) - mid, R - mid, k - 1));
  res = max(res,
            solve(max(l, mid + 1) - mid, r - mid, L, min(mid - 1, R), k - 1));
  res = max(res, solve(max(l, mid + 1) - mid, r - mid, max(L, mid + 1) - mid,
                       R - mid, k - 1));
  return res;
}
void Solve() { cout << solve(l1, r1, l2, r2, 30) << '\n'; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ReadInput();
  Solve();
}
