#include<bits/stdc++.h> using namespace std; int main(){ int a,b,x,y; cin>>a>>b>>x>>y; cout<<min(abs(a-b),abs(a-x)+abs(b-y)); return 0; }