#include <bits/stdc++.h>
using namespace std;
int a[31];
void mi() {
  a[0] = 1;
  for (int i = 1; i < 31; i++) {
    a[i] = 2 * a[i - 1];
  }
}
pair<int, int> find(int x1, int x2);
int solve(int x_b, int y_b, pair<int, int> z_b, int x_s, int y_s,
          pair<int, int> z_s);
int findlongest(int x1, int y1, pair<int, int> v1, int x2, int y2,
                pair<int, int> v2);
int main() {
  mi();
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  pair<int, int> z1 = find(x1, y1);
  pair<int, int> z2 = find(x2, y2);
  if (z1.first > z2.first) {
    cout << solve(x1, y1, z1, x2, y2, z2) << endl;
  } else if (z1.first < z2.first) {
    cout << solve(x2, y2, z2, x1, y1, z1) << endl;
  } else {
    cout << findlongest(x1, y1, z1, x2, y2, z2) << endl;
  }
  return 0;
}
int solve(int x_b, int y_b, pair<int, int> z_b, int x_s, int y_s,
          pair<int, int> z_s) {
  pair<int, int> b_l = pair<int, int>(0, 0), b_r = pair<int, int>(0, 0);
  pair<int, int> s_l = pair<int, int>(0, 0), s_r = pair<int, int>(0, 0);
  int Llr = 0, Lll = 0, Lrr = 0, Lrl = 0;
  int Ll = 0, Lr = 0;
  int tmp;
  if (y_b > z_b.second) {
    tmp = (int)log2(y_b - z_b.second) + 1;
    b_r = pair<int, int>(tmp, z_b.second + a[tmp - 1]);
  }
  if (x_b < z_b.second) {
    tmp = (int)log2(z_b.second - x_b) + 1;
    b_l = pair<int, int>(tmp, z_b.second - a[tmp - 1]);
  }
  if (z_s.first < b_l.first || z_s.first < b_r.first) {
    return y_s - x_s + 1;
  }
  if (y_s > z_s.second) {
    tmp = (int)log2(y_s - z_s.second) + 1;
    s_r = pair<int, int>(tmp, z_s.second + a[tmp - 1]);
  }
  if (x_s < z_s.second) {
    tmp = (int)log2(z_s.second - x_s) + 1;
    s_l = pair<int, int>(tmp, z_s.second - a[tmp - 1]);
  }
  if (y_b > z_b.second) {
    if (b_r.first == z_s.first) {
      Lr = findlongest(z_b.second + 1, y_b, b_r, x_s, y_s, z_s);
    } else if (b_r.first < s_l.first || b_r.first < s_r.first) {
      Lr = y_b - z_b.second;
    } else {
      if (s_l.first < b_r.first) {
        Lrl = z_s.second - x_s;
      } else {
        Lrl = findlongest(z_b.second + 1, y_b, b_r, x_s, z_s.second - 1, s_l);
      }
      if (s_r.first < b_r.first) {
        Lrr = y_s - z_s.second;
      } else {
        Lrr = findlongest(z_b.second + 1, y_b, b_r, z_s.second + 1, y_s, s_r);
      }
      Lr = max(Lrl, Lrr);
    }
  }
  if (z_b.second > x_b) {
    if (b_l.first == z_s.first) {
      Ll = findlongest(x_b, z_b.second - 1, b_l, x_s, y_s, z_s);
    } else if (b_l.first < s_l.first || b_l.first < s_r.first) {
      Ll = z_b.second - x_b;
    } else {
      if (s_l.first < b_l.first) {
        Lll = z_s.second - x_s;
      } else {
        Lll = findlongest(x_b, z_b.second - 1, b_l, x_s, z_s.second - 1, s_l);
      }
      if (s_r.first < b_l.first) {
        Llr = y_s - z_s.second;
      } else {
        Llr = findlongest(x_b, z_b.second - 1, b_l, z_s.second + 1, y_s, s_r);
      }
      Ll = max(Llr, Lll);
    }
  }
  return max(Ll, Lr);
}
pair<int, int> find(int x1, int x2) {
  int j;
  for (j = 30; j >= 1; j--) {
    if ((x1 + a[j - 1]) % a[j] == 0) {
      return pair<int, int>(j, x1);
    }
    if ((x1 + a[j - 1]) / a[j] != (x2 + a[j - 1]) / a[j]) {
      int t = (x2 + a[j - 1]) / a[j];
      return pair<int, int>(j, a[j - 1] * (2 * t - 1));
    }
  }
  return pair<int, int>(0, 0);
}
int findlongest(int x1, int y1, pair<int, int> v1, int x2, int y2,
                pair<int, int> v2) {
  if (x1 == y1 || x2 == y2) {
    return 1;
  }
  int l1_1 = v1.second - x1;
  int l1_2 = y1 - v1.second;
  int l2_1 = v2.second - x2;
  int l2_2 = y2 - v2.second;
  int lmid = min(l1_2, l2_2) + 1 + min(l1_1, l2_1);
  if ((l1_1 >= l1_2 && l2_1 >= l2_2) || (l1_1 <= l1_2 && l2_1 <= l2_2)) {
    return lmid;
  }
  int laside;
  if (l1_1 >= l1_2) {
    int z1 = (int)log2(v1.second - x1) + 1;
    int loc1 = v1.second - a[z1 - 1];
    int z2 = (int)log2(y2 - v2.second) + 1;
    int loc2 = v2.second + a[z2 - 1];
    if (z1 < z2) {
      laside = v1.second - x1;
    } else if (z1 > z2) {
      laside = y2 - v2.second;
    } else {
      laside = findlongest(x1, v1.second - 1, pair<int, int>(z1, loc1),
                           v2.second + 1, y2, pair<int, int>(z2, loc2));
    }
  } else {
    int z1 = (int)log2(y1 - v1.second) + 1;
    int loc1 = v1.second + a[z1 - 1];
    int z2 = (int)log2(v2.second - x2) + 1;
    int loc2 = v2.second - a[z2 - 1];
    if (z1 < z2) {
      laside = y1 - v1.second;
    } else if (z1 > z2) {
      laside = v2.second - x2;
    } else {
      laside = findlongest(v1.second + 1, y1, pair<int, int>(z1, loc1), x2,
                           v2.second - 1, pair<int, int>(z2, loc2));
    }
  }
  return max(laside, lmid);
}
