#include <bits/stdc++.h>
const double eps = (1e-5);
using namespace std;
int dcmp(long double a, long double b) {
  return fabsl(a - b) <= eps ? 0 : (a > b) ? 1 : -1;
}
int getBit(int num, int idx) { return ((num >> idx) & 1) == 1; }
int setBit1(int num, int idx) { return num | (1 << idx); }
long long setBit0(long long num, int idx) { return num & ~(1ll << idx); }
long long flipBit(long long num, int idx) { return num ^ (1ll << idx); }
void M() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int countNumBit1(int mask) {
  int ret = 0;
  while (mask) {
    mask &= (mask - 1);
    ++ret;
  }
  return ret;
}
long long go(int L1, int R1, int L2, int R2, int k) {
  if (R1 < L1 || R2 < L2) return 0;
  int v = (1 << k);
  if (L1 > v) {
    L1 -= v;
    R1 -= v;
  }
  if (L2 > v) {
    L2 -= v;
    R2 -= v;
  }
  if (L2 >= L1 && R2 <= R1) return R2 - L2 + 1;
  if (L1 >= L2 && R1 <= R2) return R1 - L1 + 1;
  long long mx = min(R1, R2) - max(L1, L2) + 1;
  mx = max(mx, go(L1, min(R1, v - 1), L2, min(R2, v - 1), k - 1));
  mx = max(mx, go(1, R1 - v, L2, min(R2, v - 1), k - 1));
  mx = max(mx, go(L1, min(R1, v - 1), 1, R2 - v, k - 1));
  return mx;
}
int main() {
  long long L1, L2, R1, R2;
  cin >> L1 >> R1 >> L2 >> R2;
  cout << go(L1, R1, L2, R2, 30) << endl;
}
