#include <iostream>
using namespace std;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a, b, x, y;
    cin >> a >> b >> x >> y;
    if(a == x) cout << 2;
    else if(b == y) cout << 2;
    else if(abs(x - a) != abs(y - b)) cout << 0;
    else cout << 1;
    return 0;
}