// goodwincommaderek@gmail.com import java.util.Scanner; public class trianglesofasquare_dg_ac { static final int SIDE_LEN = 2024; public static void main(String[] args) { Scanner in = new Scanner(System.in); int x1 = in.nextInt(); int y1 = in.nextInt(); int x2 = in.nextInt(); int y2 = in.nextInt(); int possible = 4; if (x1 == 0 || x1 == SIDE_LEN) possible--; if (x2 == 0 || x2 == SIDE_LEN) possible--; if (y1 == 0 || y1 == SIDE_LEN) possible--; if (y2 == 0 || y2 == SIDE_LEN) possible--; System.out.println(possible); } }