#include <bits/stdc++.h>
using namespace std;
long long int mida[31];
long long int mig[31];
long long int sol = 0;
void calcula(pair<long long int, long long int> p1,
             pair<long long int, long long int> p2, long long int nivel) {
  if (p1.first > p1.second or p2.first > p2.second) return;
  if (p2 < p1) swap(p1, p2);
  if (p2.first <= p1.first or p2.second <= p1.second) {
    sol = max(sol, min(p1.second, p2.second) - max(p1.first, p2.first) + 1);
    return;
  }
  if (nivel == 1) return;
  if (p1.first <= mig[nivel] and mig[nivel] <= p1.second and
      p2.first <= mig[nivel] and mig[nivel] <= p2.second) {
    sol = max(sol, min(p1.second, p2.second) - max(p1.first, p2.first) + 1);
    if (p1.first < mig[nivel] and mig[nivel] < p2.second)
      calcula(pair<long long int, long long int>(p1.first, mig[nivel] - 1),
              pair<long long int, long long int>(1, p2.second - mig[nivel]),
              nivel - 1);
    return;
  }
  if (p1.first <= mig[nivel] and mig[nivel] <= p1.second) {
    if (p1.first == 1) {
      sol = max(sol, p2.second - p2.first + 1);
      return;
    }
    calcula(pair<long long int, long long int>(p1.first, mig[nivel] - 1),
            pair<long long int, long long int>(p2.first - mig[nivel],
                                               p2.second - mig[nivel]),
            nivel - 1);
    calcula(pair<long long int, long long int>(1, p1.second - mig[nivel]),
            pair<long long int, long long int>(p2.first - mig[nivel],
                                               p2.second - mig[nivel]),
            nivel - 1);
    return;
  }
  if (p2.first <= mig[nivel] and mig[nivel] <= p2.second) {
    if (p2.second == mida[nivel]) {
      sol = max(sol, p1.second - p1.first + 1);
      return;
    }
    calcula(pair<long long int, long long int>(p1.first, p1.second),
            pair<long long int, long long int>(p2.first, mig[nivel] - 1),
            nivel - 1);
    calcula(pair<long long int, long long int>(p1.first, p1.second),
            pair<long long int, long long int>(1, p2.second - mig[nivel]),
            nivel - 1);
    return;
  }
  if (p1.first > mig[nivel])
    p1 = pair<long long int, long long int>(p1.first - mig[nivel],
                                            p1.second - mig[nivel]);
  if (p2.first > mig[nivel])
    p2 = pair<long long int, long long int>(p2.first - mig[nivel],
                                            p2.second - mig[nivel]);
  calcula(p1, p2, nivel - 1);
}
int main() {
  mida[1] = 1;
  mig[1] = 1;
  for (int i = 2; i <= 30; i++) {
    mida[i] = 2 * mida[i - 1] + 1;
    mig[i] = mida[i - 1] + 1;
  }
  pair<long long int, long long int> p1, p2;
  cin >> p1.first >> p1.second >> p2.first >> p2.second;
  calcula(p1, p2, 30);
  cout << sol << endl;
}
