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.util.*;
import java.io.*;

public class CF617D{
	public static void main(String[] args){
		InputReader sc = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int x1 = sc.nextInt();
		int y1 = sc.nextInt();
		int x2 = sc.nextInt();
		int y2 = sc.nextInt();
		int x3 = sc.nextInt();
		int y3 = sc.nextInt();

		if(x1 == x2){
			if(x2 == x3){
				out.println("1");
				out.close();
				return;
			}
			else if(y3 == y1 || y3==y2){
				out.println("2");
				out.close();
				return;
			}
			else{
				if(y3 < Math.min(y1,y2) || y3 > Math.max(y1,y2)){
					out.println("2");
					out.close();
					return;
				}
				else{
					out.println("3");
					out.close();
					return;
				}
			}
		}
		else if (x1 == x3) {
			if (y2 == y1 || y2 == y3) {
				out.println("2");				
				out.close();
				return;
			}
			else{
				if(y2 < Math.min(y1,y3) || y2 > Math.max(y1,y3)){
					out.println("2");
					out.close();
					return;
				}
				else{
					out.println("3");
					out.close();
					return;
				}
			}
		}
		else if(x2 == x3){
			if (y1 == y2 || y1 == y3) {
				out.println("2");				
				out.close();
				return;
			}
			else{
				if(y1 < Math.min(y3,y2) || y1 > Math.max(y3,y2)){
					out.println("2");
					out.close();
					return;
				}
				else{
					out.println("3");
					out.close();
					return;
				}
			}
		}

		else if(y1 == y2){
			if(y2 == y3){
				out.println("1");
				out.close();
				return;
			}
			else if(x3 < Math.min(x1,x2) || x3 > Math.max(x1,x2)){
				out.println("2");
				out.close();
				return;				
			}
			else{
				out.println("3");
				out.close();
				return;
			}
		}
		else if(y2==y3){
			if(x1 < Math.min(x2,x3) || x1 > Math.max(x3,x2)){
				out.println("2");
				out.close();
				return;				
			}
			else{
				out.println("3");
				out.close();
				return;
			}
		}
		else if( y1 == y3){
			if(x2 < Math.min(x1,x3) || x2 > Math.max(x1,x3)){
				out.println("2");
				out.close();
				return;				
			}
			else{
				out.println("3");
				out.close();
				return;
			}
		}
		else{
			out.println("3");
			out.close();
			return;
		}
	}
}
class InputReader{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;
 
	public InputReader(InputStream stream) {
		this.stream = stream;
	}
 
	public static boolean isWhitespace(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
	
	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}
 
	public int nextInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
 
	public long nextLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
 
	public String nextToken() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public String nextLine() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

 
	public int[] nextIntArray(int n) {
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nextInt();
		}
		return arr;
	}
	  
	public long[] nextLongArray(int n) {
		long[] arr = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nextLong();
		}
		return arr;
	}

	public void pArray(int[] arr){
		for (int i=0; i<arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	public void pArray(long[] arr){
		for (int i=0; i<arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;		
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}
 
	private boolean isEndOfLine(int c) {
		return c == '\n' || c == '\r' || c == -1;
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}