• Source
    1. #include<bits/stdc++.h>
    2.  
    3. using namespace std;
    4.  
    5. int main()
    6. {
    7. int a,b,c,d,check,check1;
    8.  
    9. while(scanf("%d%d%d%d",&a,&b,&c,&d)==4)
    10. {
    11. if(a==0 && b==0 && c==0 && d==0)
    12. break;
    13.  
    14. check = abs(a-c);
    15.  
    16. check1 = abs(b-d);
    17.  
    18. if(check==check1 && check==0)
    19. {
    20. puts("0");
    21. }
    22. else if(check==check1 || a==c || b==d)
    23. {
    24. puts("1");
    25. }
    26. else
    27. {
    28. puts("2");
    29. }
    30. }
    31.  
    32. return 0;
    33. }