#include <bits/stdc++.h>
using namespace std;
void dfs(int l, int r, int dep, vector<pair<int, int> > &ans) {
  if (l > r) return;
  ans.push_back(make_pair(l, r));
  int n = (1 << dep) - 2;
  if (l == 0 && r == n) return;
  int mid = n / 2;
  int l_next[] = {l, max(l, mid + 1) - (mid + 1)};
  int r_next[] = {min(r, mid - 1), r - (mid + 1)};
  for (int i = 0; i < (2); i++) dfs(l_next[i], r_next[i], dep - 1, ans);
}
int main() {
  int l1, r1, l2, r2;
  scanf("%d%d%d%d", &l1, &r1, &l2, &r2);
  l1--;
  r1--;
  l2--;
  r2--;
  vector<pair<int, int> > ans1, ans2;
  dfs(l1, r1, 30, ans1);
  dfs(l2, r2, 30, ans2);
  int ans_max = 0;
  for (int i = 0; i < (ans1.size()); i++)
    for (int j = 0; j < (ans2.size()); j++) {
      ans_max = max(ans_max, min(ans1[i].second, ans2[j].second) -
                                 max(ans1[i].first, ans2[j].first) + 1);
    }
  printf("%d\n", ans_max);
  return 0;
}
