#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define pb push_back
#define endl "\n"
#define amfetamin ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cerr.tie(0);
#define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
const int N = 2e5 + 5;
int main()
{
amfetamin;
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
if (x1 == x2 || y1 == y2)
    cout << 2;
else
{
    if (y2 - y1 == x2 - x1)
        cout << 1;
    else
    if (y2 - y1 == x1 - x2)
        cout << 1;
    else
        cout << 0;
}

}