#include <bits/stdc++.h>
using namespace std;
int ans;
set<int> s;
set<int>::iterator it;
void init() {
  int i, x;
  s.clear();
  for (i = 1, x = 1; i <= 30; ++i) {
    x <<= 1;
    s.insert(x);
  }
}
inline int calc(int l1, int r1, int l2, int r2) {
  return (
      (0) > (((r1) < (r2) ? (r1) : (r2)) - ((l1) > (l2) ? (l1) : (l2)) + 1)
          ? (0)
          : (((r1) < (r2) ? (r1) : (r2)) - ((l1) > (l2) ? (l1) : (l2)) + 1));
}
inline int small(int &l, int &r) {
  int x;
  while (true) {
    x = 1 << (int)log2((double)r);
    if (x < l) {
      l -= x, r -= x;
    } else {
      break;
    }
  }
  return x;
}
void dfs(int l1, int r1, int l2, int r2) {
  if (l1 > r1 || l2 > r2) return;
  if (r1 - l1 + 1 <= ans || r2 - l2 + 1 <= ans) return;
  int m1 = small(l1, r1), m2 = small(l2, r2);
  ans = ((ans) > (calc(l1, r1, l2, r2)) ? (ans) : (calc(l1, r1, l2, r2)));
  if (m1 == m2) {
    dfs(l1, r1, l2, m2 - 1);
    dfs(l1, r1, m2 + 1, r2);
  } else {
    if (m1 < m2) {
      dfs(l1, r1, l2, m2 - 1);
      dfs(l1, r1, m2 + 1, r2);
    } else {
      dfs(l1, m1 - 1, l2, r2);
      dfs(m1 + 1, r1, l2, r2);
    }
  }
}
int main() {
  int l1, r1, l2, r2;
  init();
  scanf("%d%d%d%d", &l1, &r1, &l2, &r2);
  ans = 0;
  dfs(l1, r1, l2, r2);
  printf("%d", ans);
  return 0;
}
