#include <bits/stdc++.h>
#pragma GCC optimize(114514)
using namespace std;
const long long maxnode = 450010;
const long long maxn = 200010;
const long long maxm = 100010;
const long long mod = 1e9 + 7;
const double pi = acos(-1.0);
const double eps = 1e-8;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long qpow(long long a, long long b) {
  long long sum = 1;
  while (b) {
    if (b & 1) {
      sum = (sum * a);
      b--;
    }
    b /= 2;
    a = a * a;
  }
  return sum;
}
long long powmod(long long a, long long b, long long mod) {
  long long sum = 1;
  while (b) {
    if (b & 1) {
      sum = (sum * a) % mod;
      b--;
    }
    b /= 2;
    a = a * a % mod;
  }
  return sum;
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = 10 * x + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline long long readll() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = 10 * x + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void write(int x) {
  if (x < 0) x = ~x + 1, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
int n, a, b, k, m;
string str1, str2;
int l1, r1, l2, r2;
int sol(int l1, int r1, int l2, int r2, int k) {
  if (l1 <= l2 && r1 >= r2) return (r2 - l2 + 1);
  if (l2 <= l1 && r2 >= r1) return (r1 - l1 + 1);
  if (k < 0) return 0;
  int mid = 1 << k;
  int ans = min(r1, r2) - max(l1, l2) + 1;
  if (l1 > mid) {
    l1 -= mid;
    r1 -= mid;
  }
  if (l2 > mid) {
    l2 -= mid;
    r2 -= mid;
  }
  ans = max(ans, sol(l1, min(r1, mid - 1), l2, min(r2, mid - 1), k - 1));
  if (r1 > mid && r2 > mid) {
    ans = max(ans, sol(1, r1 - mid, 1, r2 - mid, k - 1));
  }
  if (r1 > mid) {
    ans = max(ans, sol(1, r1 - mid, l2, min(r2, mid - 1), k - 1));
  }
  if (r2 > mid) {
    ans = max(ans, sol(l1, min(r1, mid - 1), 1, r2 - mid, k - 1));
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  int T;
  cin >> l1 >> r1 >> l2 >> r2;
  cout << sol(l1, r1, l2, r2, 30) << endl;
  return 0;
}
