#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, F = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') F = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * F;
}
int l1, r1, l2, r2, ans;
void solve(int l1, int r1, int l2, int r2, int dep) {
  if (r1 < l1 || r2 < l2) return;
  int L = max(l1, l2), R = min(r1, r2);
  ans = max(ans, max(R - L + 1, 0));
  if ((l1 <= l2 && r2 <= r1) || (l2 <= l1 && r1 <= r2)) return;
  int mid = 1 << (dep - 1);
  solve(min(l1, mid), min(r1, mid - 1), min(l2, mid), min(r2, mid - 1),
        dep - 1);
  solve(min(l1, mid), min(r1, mid - 1), max(l2, mid + 1) - mid,
        max(r2, mid) - mid, dep - 1);
  solve(max(l1, mid + 1) - mid, max(r1, mid) - mid, min(l2, mid),
        min(r2, mid - 1), dep - 1);
  solve(max(l1, mid + 1) - mid, max(r1, mid) - mid, max(l2, mid + 1) - mid,
        max(r2, mid) - mid, dep - 1);
}
int main() {
  l1 = read(), r1 = read(), l2 = read(), r2 = read();
  solve(l1, r1, l2, r2, 30);
  printf("%d\n", ans);
}
