There are three points marked on the coordinate plane. The goal is to make a simple polyline, without self-intersections and self-touches, such that it passes through all these points. Also, the polyline must consist of only segments parallel to the coordinate axes. You are to find the minimum number of segments this polyline may consist of.

Input

Each of the three lines of the input contains two integers. The i-th line contains integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th point. It is guaranteed that all points are distinct.

Output

Print a single number — the minimum possible number of segments of the polyline.

Examples

Input

1 -1
1 1
1 2


Output

1


Input

-1 -1
-1 3
4 3


Output

2


Input

1 1
2 3
3 2


Output

3

Note

The variant of the polyline in the first sample: <image> The variant of the polyline in the second sample: <image> The variant of the polyline in the third sample: <image>
import java.io.*;
import java.util.StringTokenizer;

/**
 * Created by peacefrog on 1/23/16.
 * Time : 9:29 PM
 */

public class CF617D {
	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	PrintWriter out;
	long timeBegin, timeEnd;

	public void runIO() throws IOException {
		timeBegin = System.currentTimeMillis();

		InputStream inputStream;
		OutputStream outputStream;


		if (ONLINE_JUDGE) {
			inputStream = System.in;
			Reader.init(inputStream);
			outputStream = System.out;

			out = new PrintWriter(outputStream);

		} else {
			inputStream = new FileInputStream("/home/peacefrog/Dropbox/IdeaProjects/Problem Solving/input");
			Reader.init(inputStream);
			out = new PrintWriter(System.out);
		}

		solve();

		out.flush();
		out.close();
		timeEnd = System.currentTimeMillis();

		System.err.println("Time = " + (timeEnd - timeBegin));

	}

	public boolean isTwo(int[]x , int[] y){
		if ((x[0] == x[1]))
			if ( y[0] > y[1]){
				return  !(y[0] > y[2] && y[1] < y[2]);
			} else {
				return !(y[0] < y[2] && y[1] > y[2]);
			}
		if ((x[0] == x[2]))
			if (y[0] > y[2]) return !(y[0] > y[1] && y[2] < y[1]);
			else return !(y[0] < y[1] && y[2] > y[1]);

		if ((x[1] == x[2]))
			if(y[1]> y[2]) return !(y[1] > y[0] && y[2] < y[0]) ;
			else return !(y[1] < y[0] && y[2] > y[0]);

		if ((y[0] == y[1]))
			if (x[0]>x[1])
				return !(x[0] > x[2] && x[1] < x[2]);
			else return !(x[0] < x[2] && x[1] > x[2]);

		if ((y[0] == y[2]))
			if (x[0] > x[2])return !(x[0] > x[1] && x[2] < x[1]);
			else return !(x[0] < x[1] && x[2] > x[1]);
		if ((y[1] == y[2]))
			if(x[1] > x[2]) return !(x[1] > x[0] && x[2] < x[0]);
			else return  !(x[1] < x[0] && x[2] > x[0]);

		return false;
	}

	/*
	 * Start Solution Here
	 */
	private void solve() throws IOException {
//		int x1 = Reader.nextInt(), y1 = Reader.ne; //This Variable default in Code Template
		int [] x = new int[4];
		int y[] = new int[4];


		for (int i = 0; i < 3; i++) {

			x[i] = Reader.nextInt() ;
			y[i] = Reader.nextInt();
		}
		x[3] = x[0];
		y[3] = y[0];

		int dx = 0, dy = 0;

		for (int i = 1; i < 4; i++) {
			dx += Math.abs(x[i]-x[i-1]);
			dy += Math.abs(y[i] - y[i-1]);
		}

		if(dx ==0 || dy ==0 ){
			out.println(1);
			return;
		}

		long a = (long) (Math.pow(x[0]-x[1] , 2)+Math.pow(y[0]-y[1] , 2));
		long b = (long) (Math.pow(x[2]-x[1] , 2)+Math.pow(y[2]-y[1] , 2));
		long c = (long) (Math.pow(x[0]-x[2] , 2)+Math.pow(y[0]-y[2] , 2));

//		out.println(a + " " + b + " " + c);
//		out.println("c " + (a+b));
//		out.println("a " + (b+c));
//		out.println("b " + (a+c));

		if( (a+b)== c || (b+c)==a || (a+c)==b  || isTwo(x, y )){
			out.println(2);
			return;
		}


		out.println(3);
	}

	public static void main(String[] args) throws IOException {

		new CF617D().runIO();
	}

	static class Reader {
		static BufferedReader reader;
		static StringTokenizer tokenizer;

		/**
		 * call this method to initialize reader for InputStream
		 */
		static void init(InputStream input) {
			reader = new BufferedReader(new InputStreamReader(input));
			tokenizer = new StringTokenizer("");
		}

		/**
		 * get next word
		 */
		static String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		static String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return "";
		}

		static char nextChar() throws IOException {
			return (char) reader.read();
		}

		static int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		static long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		static double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		static long[] nextLongArray(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLong();
			}

			return arr;
		}

		static int[] nextIntArray(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}

			return arr;
		}
	}

}

