#include <bits/stdc++.h> 
using namespace std;
 
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
#define PI 3.14159265359  
const long long INF = 1LL << 60;
long long MOD = 1000000007;
long long gcd(long long a, long long b) { return b ? gcd(b, a%b) : a; }
long long lcm (int a, int b){return  (long long) a*b /gcd(a,b);}

int main(){
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    int r = abs(r2-r1), c = abs(c2-c1);
    int ans = 3;
    if( r == 0 && c == 0)ans = 0;
    else if( r == c || r + c <=3 )ans = 1;
    else if ((r + c)% 2 == 0 || r + c <= 6 || abs(r-c) <= 3)ans = 2;
    cout << ans << endl;

}
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) begin(x),end(x)
#define F(i,n) for (int i = 0; i < n; ++i)
#define F1(i,n) for (int i = 1; i <= n; ++i)
#define dbg(x) cerr << #x << " = " << x << endl
#define dbgg(x) cerr << #x << " = " << x << ' '
#define T(x) x[pool]
#define mineq(x,y) { if ((x) > (y)) (x) = (y); }
#define maxeq(x,y) { if ((x) < (y)) (x) = (y); }
#define MEOW cout << "meowwwww" << '\n'; system("pause");
#define int long long
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;

template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c)
{
	s << "[ "; for (auto it : c) s << it << " "; s << "\b]\n";
	return s;
}

template<typename T>
ostream& operator <<(ostream &s, const pair<int, T> &c)
{
	s << "[ "; cout << c.fi << " , " << c.se << " ] ";
	return s;
}

int n;

void input()
{
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n;
}

void solve()
{
	vi p1, p2, p3, p4, ans;
	int k = n / 3;
	int cur = 0;
	F1 (i, 10000) while (++cur < 10000) 
		if (cur % 5 != 0 && cur * 6 <= 10000)
		{
			p1.pb(cur * 6);
			break;
		}
	cur = 0;
	F1 (i, 10000) while (++cur < 10000) 
		if (cur % 2 != 0 && cur * 15 <= 10000)
		{
			p2.pb(cur * 15);
			break;
		}
	cur = 0;
	F1 (i, 10000) while (++cur < 10000) 
		if (cur % 3 != 0 && cur * 10 <= 10000)
		{
			p3.pb(cur * 10);
			break;
		}
	cur = 0;
	F1 (i, 10000) while (++cur < 10000) 
		if (cur * 30 <= 10000)
		{
			p4.pb(cur * 30);
			break;
		}
	ans.pb(p1[0]);
	ans.pb(p2[0]);
	ans.pb(p3[0]);
	n -= 3;
	F1 (i, p1.size() - 1) if (n) { ans.pb(p1[i]); --n; }
	F1 (i, p2.size() - 1) if (n) { ans.pb(p2[i]); --n; }
	F1 (i, p3.size() - 1) if (n) { ans.pb(p3[i]); --n; }
	F1 (i, p4.size() - 1) if (n) { ans.pb(p4[i]); --n; }
	for (auto x : ans) cout << x << ' ';
	cout << '\n';
}

main()
{
	input();
	solve();
}
