#include <bits/stdc++.h>
using namespace std;
const int MAXN = 64;
int dp[MAXN + 1][MAXN + 1][MAXN + 1][MAXN + 2];
int calc(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 (r1 >= r2) return r2 - l2 + 1;
  if (k == 0) return !(l1 == r1 && l2 == r2 && l1 < l2);
  if (l1 < MAXN && l2 < MAXN && r1 < MAXN && r2 < MAXN &&
      dp[l1][r1][l2][r2] != -1)
    return dp[l1][r1][l2][r2];
  int mid = (1 << k) - 1, x;
  int *ans = &x;
  if (l1 < MAXN && l2 < MAXN && r1 < MAXN && r2 < MAXN)
    ans = &dp[l1][r1][l2][r2];
  if (r2 <= mid)
    return *ans = calc(l1, r1, l2, r2 - (r2 == mid), k - 1);
  else if (l1 > mid)
    return *ans = calc(l1 - mid - 1, r1 - mid - 1, l2 - mid - 1, r2 - mid - 1,
                       k - 1);
  if (l2 > r1) {
    if (l2 > mid)
      return *ans = calc(l1, r1, l2 - mid - 1, r2 - mid - 1, k);
    else
      return *ans = max(calc(l1, r1, l2, mid - 1, k - 1),
                        calc(l1, r1, 0, r2 - mid - 1, k - 1));
  } else if (l2 <= mid) {
    if (r1 <= mid) {
      return *ans = max(max(r1 - l2 + 1, calc(l1, r1, 0, r2 - mid - 1, k)),
                        calc(l1, r1, l2, mid - 1, k - 1));
    } else {
      return *ans = max(r1 - l2 + 1, calc(l1, r1, 0, r2 - mid - 1, k));
    }
  }
  return *ans = max(calc(l1, mid - 1, l2 - mid - 1, r2 - mid - 1, k - 1),
                    calc(0, r1 - mid - 1, l2 - mid - 1, r2 - mid - 1, k - 1));
}
int main() {
  int l1, l2, r1, r2;
  memset(dp, -1, sizeof(dp));
  cin >> l1 >> r1 >> l2 >> r2;
  cout << calc(l1 - 1, r1 - 1, l2 - 1, r2 - 1, 29) << endl;
  return 0;
}
