#include <bits/stdc++.h>

using namespace std;
struct teme{
  long long x;
  long long y;
};
int main()
{
    ios::sync_with_stdio(false);
    teme t1,t2;
    cin >> t1.x >> t1.y;
    cin >> t2.x >> t2.y;
    if(abs(t1.x-t2.x)!=abs(t1.y-t2.y)
       && t1.x !=t2.x && t1.y!=t2.y) cout << 0 << '\n';
    else if(t1.x==t2.x || t1.y==t2.y) cout << 2 << '\n';
    else cout << 1 << '\n';
    return 0;
}