#include <bits/stdc++.h>
using namespace std;
int dp[80][80][80][80];
int dfs(int l1, int r1, int l2, int r2, int dep) {
  if (l1 > r1 || l2 > r2) return 0;
  if (l1 == l2 && r1 == r2) return r1 - l1 + 1;
  if (r1 < 80 && r2 < 80 && dp[l1][r1][l2][r2] != -1) return dp[l1][r1][l2][r2];
  int mid = (1 << dep - 1) - 1;
  int res = 0;
  if (l1 <= mid && mid <= r1 && l2 <= mid && mid <= r2) {
    res = max(res, min(r1, r2) - max(l1, l2) + 1);
  }
  int l1_next[] = {l1, max(l1, mid + 1) - (mid + 1)};
  int r1_next[] = {min(r1, mid - 1), r1 - (mid + 1)};
  int l2_next[] = {l2, max(l2, mid + 1) - (mid + 1)};
  int r2_next[] = {min(r2, mid - 1), r2 - (mid + 1)};
  for (int i = 0; i < (2); i++)
    for (int j = 0; j < (2); j++)
      res = max(res,
                dfs(l1_next[i], r1_next[i], l2_next[j], r2_next[j], dep - 1));
  if (r1 < 80 && r2 < 80) dp[l1][r1][l2][r2] = res;
  return res;
}
int main() {
  int l1, r1, l2, r2;
  scanf("%d%d%d%d", &l1, &r1, &l2, &r2);
  l1--;
  r1--;
  l2--;
  r2--;
  memset(dp, -1, sizeof dp);
  printf("%d\n", dfs(l1, r1, l2, r2, 30));
  return 0;
}
