#include <bits/stdc++.h>
using namespace std;
int read() {
  int f = 1, x = 0;
  char c = getchar();
  while (c < '0' || '9' < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while ('0' <= c && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return f * x;
}
const int MAXN = 100000;
const int INF = 0x3f3f3f3f;
int ans;
void Query(int L, int R, int l1, int r1, int l2, int r2) {
  if (l1 > r1 || l2 > r2) return;
  int le = max(l1, l2), ri = min(r1, r2);
  ans = max(ans, ri - le + 1);
  if ((l1 <= l2 && r2 <= r1) || (l2 <= l1 && r1 <= r2)) return;
  int Mid = (L + R) >> 1;
  Query(L, Mid - 1, l1, min(r1, Mid - 1), l2, min(r2, Mid - 1));
  Query(L, Mid - 1, l1, min(r1, Mid - 1), max(l2, Mid + 1) - Mid, r2 - Mid);
  Query(L, Mid - 1, max(l1, Mid + 1) - Mid, r1 - Mid, l2, min(r2, Mid - 1));
  Query(L, Mid - 1, max(l1, Mid + 1) - Mid, r1 - Mid, max(l2, Mid + 1) - Mid,
        r2 - Mid);
  return;
}
int main() {
  int l1 = read(), r1 = read(), l2 = read(), r2 = read();
  Query(1, 1073741823, l1, r1, l2, r2);
  printf("%d\n", ans);
  return 0;
}
