#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
template <typename T>
void write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) {
    write(x / 10);
  }
  putchar(x % 10 + '0');
}
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  long long f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a / gcd(a, b) * b; };
long long ksm(long long a, long long n) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans = (ans * a) % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ans % mod;
}
int l1, r1, l2, r2;
long long solve(int la, int ra, int lb, int rb, int k) {
  if (k < 0) return 0;
  if (la > ra || lb > rb) return 0;
  if (la > lb) swap(la, lb), swap(ra, rb);
  if (ra >= rb) return rb - lb + 1;
  if (la == lb) return ra - la + 1;
  int len = (1 << k);
  if (lb > len) return solve(la, ra, lb - len, rb - len, k);
  if (ra < len && rb < len) return solve(la, ra, lb, rb, k - 1);
  int ans = max(solve(la, ra, lb, len - 1, k), solve(la, ra, 1, rb - len, k));
  return max(ans, ra - lb + 1);
}
int main() {
  read(l1), read(r1), read(l2), read(r2);
  write(solve(l1, r1, l2, r2, 30));
  return 0;
}
