#include <bits/stdc++.h>
using namespace std;
int main() {
  int res = 0;
  vector<int> vec1, vec2;
  int a, b, c, d;
  int i, j, k;
  int l, r;
  scanf(" %d %d %d %d", &a, &b, &c, &d);
  a--;
  b--;
  c--;
  d--;
  for (i = 1; i <= 30; i++) {
    j = (a / (1 << (i - 1)) + 1) * (1 << (i - 1)) - 1;
    if (!(((j + 1) / (1 << (i - 1))) & 1)) j += 1 << (i - 1);
    if (j > b) continue;
    k = (c / (1 << (i - 1)) + 1) * (1 << (i - 1)) - 1;
    if (!(((k + 1) / (1 << (i - 1))) & 1)) k += 1 << (i - 1);
    if (k > d) continue;
    vec1.clear();
    vec2.clear();
    vec1.push_back(j);
    if (j + (1 << i) <= b) vec1.push_back(j + (1 << i));
    vec2.push_back(k);
    if (k + (1 << i) <= d) vec2.push_back(k + (1 << i));
    for (j = 0; j < vec1.size(); j++)
      for (k = 0; k < vec2.size(); k++) {
        l = min(vec1[j] - a, vec2[k] - c);
        r = min(b - vec1[j], d - vec2[k]);
        l = min(l, (1 << (i - 1)) - 1);
        r = min(r, (1 << (i - 1)) - 1);
        res = max(res, l + r + 1);
      }
  }
  printf("%d\n", res);
  return 0;
}
