#include <bits/stdc++.h>
using namespace std;
int common(int x, int y, int z, int w) { return min(y, w) - max(x, z) + 1; }
int main() {
  int a, b, c, d;
  scanf("%d %d %d %d", &a, &b, &c, &d);
  int sol = 0;
  int div;
  int i, x, y;
  div = 1;
  for (i = 0; i < 30; i++) {
    div = div * 2;
    int ua, db, uc, dd;
    ua = ((a + div - 1) / div) * div;
    db = (b / div) * div;
    uc = ((c + div - 1) / div) * div;
    dd = (d / div) * div;
    vector<pair<int, int> > r1, r2;
    if (ua != db) {
      if (ua < db) {
        r1.push_back(make_pair(1, div - 1));
      } else {
        int x, y;
        x = a % div;
        y = b % div;
        r1.push_back(make_pair(x, y));
      }
    } else {
      if (a % div == 0 && b % div == 0) {
      } else {
        if (a % div != 0) r1.push_back(make_pair(a % div, div - 1));
        if (b % div != 0) r1.push_back(make_pair(1, b % div));
      }
    }
    if (uc != dd) {
      if (uc < dd) {
        r2.push_back(make_pair(1, div - 1));
      } else {
        int x, y;
        x = c % div;
        y = d % div;
        r2.push_back(make_pair(x, y));
      }
    } else {
      if (c % div == 0 && d % div == 0) {
      } else {
        if (c % div != 0) r2.push_back(make_pair(c % div, div - 1));
        if (d % div != 0) r2.push_back(make_pair(1, d % div));
      }
    }
    for (x = 0; x < r1.size(); x++) {
      for (y = 0; y < r2.size(); y++) {
        int sss = common(r1[x].first, r1[x].second, r2[y].first, r2[y].second);
        if (sss > sol) sol = sss;
      }
    }
  }
  printf("%d", sol);
  return 0;
}
