// Arup Guha
// 3/4/2018
// Solution to 2018 February USACO Bronze Problem: Teleportation

import java.util.*;
import java.io.*;

public class teleport {

	public static void main(String[] args) throws Exception {

		Scanner stdin = new Scanner(new File("teleport.in"));

		// Don't teleport.
		int a = stdin.nextInt();
		int b = stdin.nextInt();
		int res = Math.abs(a-b);

		// Get teleport.
		int c = stdin.nextInt();
		int d = stdin.nextInt();

		// Teleport to a->c.
		res = Math.min(res, Math.abs(a-c)+Math.abs(d-b));

		// Teleport to a->d.
		res = Math.min(res, Math.abs(a-d)+Math.abs(c-b));

		// Ta da!
		PrintWriter out = new PrintWriter(new FileWriter("teleport.out"));
		out.println(res);
		out.close();
		stdin.close();
	}
}