#include<bits/stdc++.h>
# define endl            '\n'
# define clr(x,a)        memset(x,a,sizeof(x))
# define PI              3.14159265358979323846
# define vi              vector<int>
# define fo(i,n)         for(int i=1;i<=n;i++)
# define all(a)          a.begin(), a.end()
# define deb(x)          cout<<#x<<" = "<<x<<endl;
# define pb              push_back
# define sc              scanf
# define pr              printf
# define tc              int t; cin>>t; while(t--)
typedef long long ll;
using namespace std;

const ll mxN=1000005, mxM=1000006, mod=1e9+7;
int x1, x2, y, y2;

int main(){
   cin>>x1>>y>>x2>>y2;
   if(y==y2 || x1==x2)
      cout<<2<<endl;
   else if(abs(x1-x2)==abs(y-y2))
      cout<<1<<endl;
   else cout<<0<<endl;

   return 0;
}