#include<bits/stdc++.h> using namespace std; int main() { int a,b,c,d,check,check1; while(scanf("%d%d%d%d",&a,&b,&c,&d)==4) { if(a==0 && b==0 && c==0 && d==0) break; check = abs(a-c); check1 = abs(b-d); if(check==check1 && check==0) { puts("0"); } else if(check==check1 || a==c || b==d) { puts("1"); } else { puts("2"); } } return 0; }