#include <bits/stdc++.h>
using namespace std;
const int Inf = 1000000000;
int L[50];
int check(int a, int b, int c) { return a <= c && b >= c; }
int id(int x, int mid) { return x - mid - 1; }
int sol(int k, int a, int b, int c, int d) {
  if (a > b || c > d) return -Inf;
  if (k == 0) return 1;
  if (a == 0 && b == L[k] - 1 || c == 0 && d == L[k] - 1)
    return min(b - a + 1, d - c + 1);
  int m = L[k - 1], ret = max(0, min(b, d) - max(a, c) + 1);
  if (check(a, b, m) && check(c, d, m) || (!check(a, b, m) && !check(c, d, m) &&
                                           (long long)(a - m) * (c - m) < 0)) {
    ret = max(ret, sol(k - 1, a, min(m - 1, b), max(0, id(c, m)), id(d, m)));
    ret = max(ret, sol(k - 1, c, min(m - 1, d), max(0, id(a, m)), id(b, m)));
  } else if (check(a, b, m) || check(c, d, m)) {
    ret = max(ret, sol(k - 1, a, min(m - 1, b), max(0, id(c, m)), id(d, m)));
    ret = max(ret, sol(k - 1, a, min(m - 1, b), c, min(m - 1, d)));
    ret = max(ret, sol(k - 1, c, min(m - 1, d), max(0, id(a, m)), id(b, m)));
    ret = max(ret, sol(k - 1, max(0, id(c, m)), id(d, m), max(0, id(a, m)),
                       id(b, m)));
  } else {
    if (a < m)
      ret = max(ret, sol(k - 1, a, b, c, d));
    else
      ret = max(ret, sol(k - 1, id(a, m), id(b, m), id(c, m), id(d, m)));
  }
  return ret;
}
int main() {
  L[0] = 1;
  for (int i = 1; i <= 30; i++) L[i] = L[i - 1] * 2 + 1;
  int a, b, c, d;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  a--;
  b--;
  c--;
  d--;
  printf("%d\n", sol(30, a, b, c, d));
  return 0;
}
