#include <bits/stdc++.h>
using namespace std;
int max2;
int two[35];
void DFS(int K, int L1, int R1, int L2, int R2) {
  if (((R1 - L1 + 1) <= max2) || ((R2 - L2 + 1) <= max2)) return;
  if (K == 0) {
    if (1 > max2) max2 = 1;
    return;
  }
  int L3, R3;
  if (L1 >= L2)
    L3 = L1;
  else
    L3 = L2;
  if (R1 <= R2)
    R3 = R1;
  else
    R3 = R2;
  if (R3 >= L3) {
    if ((R3 - L3 + 1) > max2) max2 = R3 - L3 + 1;
  }
  int X = two[K - 1];
  char cr1 = 0;
  char cr2 = 0;
  if ((R1 >= X) && (L1 <= X)) cr1 = 1;
  if ((R2 >= X) && (L2 <= X)) cr2 = 1;
  if ((cr1) && (cr2)) {
    DFS(K - 1, L1, X - 1, 1, R2 - X);
    DFS(K - 1, L2, X - 1, 1, R1 - X);
  } else if (cr1) {
    int nl, nr;
    nl = L2;
    nr = R2;
    if (nl >= X) nl -= X;
    if (nr >= X) nr -= X;
    DFS(K - 1, L1, X - 1, nl, nr);
    DFS(K - 1, 1, R1 - X, nl, nr);
  } else if (cr2) {
    int nl, nr;
    nl = L1;
    nr = R1;
    if (nl >= X) nl -= X;
    if (nr >= X) nr -= X;
    DFS(K - 1, L2, X - 1, nl, nr);
    DFS(K - 1, 1, R2 - X, nl, nr);
  } else {
    int nl1, nr1, nl2, nr2;
    nl1 = L1;
    nr1 = R1;
    if (nl1 >= X) nl1 -= X;
    if (nr1 >= X) nr1 -= X;
    nl2 = L2;
    nr2 = R2;
    if (nl2 >= X) nl2 -= X;
    if (nr2 >= X) nr2 -= X;
    DFS(K - 1, nl1, nr1, nl2, nr2);
  }
}
int main() {
  two[0] = 1;
  int i;
  for (i = 1; i <= 30; i++) two[i] = two[i - 1] * 2;
  int L1, R1, L2, R2;
  scanf("%d %d %d %d", &L1, &R1, &L2, &R2);
  max2 = 0;
  DFS(30, L1, R1, L2, R2);
  printf("%d\n", max2);
  return 0;
}
