#include <bits/stdc++.h>
using namespace std;
int solve(int l1, int r1, int l2, int r2, int step = 30) {
  if (l1 > r1) {
    return 0;
  }
  if (l2 > r2) {
    return 0;
  }
  int ovl = max(l1, l2);
  int ovr = min(r1, r2);
  int overlap = ((ovr >= ovl) ? (ovr - ovl + 1) : 0);
  int t = (1 << step) - 1;
  int m = t / 2 + 1;
  if ((l1 == l2) || (r1 == r2) || (t == 1) ||
      (l1 <= m && l2 <= m && r1 >= m && r2 >= m &&
       ((l1 <= l2 && r1 >= r2) || (l2 <= l1 && r2 >= r1)))) {
    return overlap;
  }
  int l[4] = {min(l1, m), max(m + 1, l1) - m, min(l2, m), max(m + 1, l2) - m};
  int r[4] = {min(r1, m - 1), max(m, r1) - m, min(r2, m - 1), max(m, r2) - m};
  int res = overlap;
  for (int i = 0; i < 2; i++) {
    for (int j = 2; j < 4; j++) {
      res = max(res, solve(l[i], r[i], l[j], r[j], step - 1));
    }
  }
  return res;
}
int main() {
  int l1, r1, l2, r2;
  bool before = false;
  while (cin >> l1 >> r1 >> l2 >> r2) {
    if (before) {
      cout << endl;
    }
    before = true;
    cout << solve(l1, r1, l2, r2) << endl;
  }
  return 0;
}
