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.math.BigInteger;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;

public class D
{
	String line;
	StringTokenizer inputParser;
	BufferedReader is;
	FileInputStream fstream;
	DataInputStream in;
	
	void openInput(String file)
	{

		if(file==null)is = new BufferedReader(new InputStreamReader(System.in));//stdin
		else
		{
			try{
		
				
			fstream = new FileInputStream(file);
			in = new DataInputStream(fstream);
			is = new BufferedReader(new InputStreamReader(in));
			}catch(Exception e)
			{
				System.err.println(e);
			}
		}

	}
	
	void readNextLine()
	{
		try {
			line = is.readLine();
			if(line!=null)inputParser = new StringTokenizer(line, " ");
			//System.err.println("Input: " + line);
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}	
		
	}
	
	int NextInt()
	{
		String n = inputParser.nextToken();
		int val = Integer.parseInt(n);
		
		//System.out.println("I read this number: " + val);
		return val;
	}
    
    double NextDouble()
    {
            String n = inputParser.nextToken();
            double val = Double.parseDouble(n);
            
            //System.out.println("I read this number: " + val);
            return val;
    }
	
	long NextLong()
    {
            String n = inputParser.nextToken();
            
            long val = Long.parseLong(n);
            
            return val;
    }
	
	String NextString()
	{
		String n = inputParser.nextToken();
		return n;
	}
	
	void closeInput()
	{
		try {
			is.close();
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}
			
	}
	
	
	public static void main(String [] argv)
	{
		String filePath=null;
		if(argv.length>0)filePath=argv[0];
		new D(filePath);
	}

	String resnow;
	int N,A,CF,CM;
	long M;
	public D(String inputFile)
	{
		openInput(inputFile);
		//readNextLine();
		int T=1;//NextInt();
		StringBuilder sb = new StringBuilder();
		for(int t=1; t<=T; t++)
		{
			int [] x = new int[3];
			int [] y = new int[3];
			for(int i=0; i<3; i++)
			{
				readNextLine();
				x[i] = NextInt();
				y[i] = NextInt();
			}
			
			int res = 3;
			if(x[0]==x[1]&&x[1]==x[2]||y[0]==y[1]&&y[1]==y[2])res=1;
			else
			{
				if(isGood(x[0],x[1], y[0],y[1],y[2]))res=2;
				if(isGood(x[0],x[2], y[0],y[2],y[1]))res=2;
				if(isGood(x[1],x[2], y[1],y[2],y[0]))res=2;
				if(isGood(y[0],y[1], x[0],x[1],x[2]))res=2;
				if(isGood(y[0],y[2], x[0],x[2],x[1]))res=2;
				if(isGood(y[1],y[2], x[1],x[2],x[0]))res=2;
			}
			sb.append(res);
		}
		System.out.print(sb);
		
		closeInput();		
	}

	private boolean isGood(int x0, int x1, int y0, int y1, int y2) {
		if(x0!=x1)return false;
		if(y2>y0&&y2<y1)return false;
		if(y2>y1&&y2<y0)return false;
		return true;
	}
	
}