#include <bits/stdc++.h>
using namespace std;
const int N = 510;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-6;
const double PI = acos(-1.0);
int dfs(int l1, int r1, int l2, int r2, int k) {
  if (l1 > r1) return 0;
  if (l2 > r2) return 0;
  if (l1 > l2 || l1 == l2 && r1 < r2) swap(l1, l2), swap(r1, r2);
  if (r1 >= r2) return r2 - l2 + 1;
  int len = 1 << k;
  if (l2 > len) return dfs(l1, r1, l2 - len, r2 - len, k);
  if (r1 < len && r2 < len) return dfs(l1, r1, l2, r2, k - 1);
  int ans = max(dfs(l1, r1, l2, len - 1, k), dfs(l1, r1, 1, r2 - len, k));
  return max(ans, r1 - l2 + 1);
}
void solve() {
  int l1, r1, l2, r2;
  cin >> l1 >> r1 >> l2 >> r2;
  cout << dfs(l1, r1, l2, r2, 30) << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
