#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll a, b, c, d, ans = 3;
  cin >> a >> b >> c >> d;
  ll x = c - a, y = d - b;
  if (c == a && d == b)
    ans = 0;
  else if (x == y || x == -y || abs(x) + abs(y) <= 3)
    ans = 1;
  else if ((x + y) % 2 == 0 || abs(x + y) <= 3 || abs(x - y) <= 3 ||
           abs(x) + abs(y) <= 6)
    ans = 2;
  cout << ans << endl;
  return 0;
}
#include "bits/stdc++.h"
using namespace std;
#define int long long int
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
void local() {
    #ifndef ONLINE_JUDGE 
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

signed main() {
    IOS;
    //local();

    int a[3]; cin>>a[0]>>a[1]>>a[2];
    sort(a, a+3);
    if(a[0]==a[1] ) cout<<a[2];
    else if(a[1]==a[2]) cout<<a[0];
    else cout<<0;

    return 0;
}