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.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.security.interfaces.DSAKey;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class a {
	public static int k;

	public static class node implements Comparable<node> {
		long dis1;
		long dis2;

		node(long d1, long d2) {
			dis1 = d1;
			dis2 = d2;

		}

		@Override
		public int compareTo(node o) {

			return 0;
		}
	}

	public static class point {
		long day;
		int idx;

		point(long x, int val) {
			this.day = x;
			this.idx = val;
		}

		point() {
		}

	}

	public static BigInteger gcd(BigInteger a, BigInteger b) {
		if (b.equals(BigInteger.ZERO))
			return a;
		return gcd(b, a.mod(b));
	}

	public static long gcd1(long a, long b) {
		if (b == 0)
			return a;
		return gcd1(b, a % b);
	}

	public static ArrayList<Integer> prime;

	public static void sieve(int n) {
		boolean vis[] = new boolean[n + 5];
		vis[1] = true;
		vis[0] = true;
		for (int i = 2; i <= n; i++) {
			if (!vis[i]) {
				prime.add(i);
				for (long j = (long) i * (long) i; j <= n; j += i) {
					vis[(int) j] = true;
				}
			}
		}
	}

	public static int tree[][];
	public static boolean end[][];
	public static int counter;

	public static void trie(String a) {
		int st = 0;

		for (int i = 0; i < a.length(); i++) {
			if (tree[a.charAt(i) - 'a'][st] == 0) {
				tree[a.charAt(i) - 'a'][st] = counter++;
			}

			st = tree[a.charAt(i) - 'a'][st];
		}
		end[a.charAt(a.length() - 1) - 'a'][st] = true;

	}

	public static int seg[][];

	public static int get(int s, int e, int p, int from, int to, int seg[]) {
		if (s >= from && e <= to)
			return seg[p];
		if (s > to || e < from)
			return 0;
		int mid = (s + e) / 2;
		int one = get(s, mid, p * 2, from, to, seg);
		int two = get(mid + 1, e, p * 2 + 1, from, to, seg);
		return Math.max(one, two);
	}

	public static long comp(int n, int r) {
		long ans = 1;
		r = Math.min(r, n - r);
		for (int i = 1; i <= r; i++) {
			ans = ans * ((long) n - (long) i + 1L) / (long) i;
		}
		return ans;
	}

	public static ArrayList<Integer> arr[];
	public static boolean vis[];
	public static Stack<Integer> S;

	public static void bfs(int node) {
		for (int i = 0; i < arr[node].size(); i++) {
			int k = arr[node].get(i);
			if (vis[k] == false) {
				vis[k] = true;
				S.push(k);
				bfs(k);
			}
		}
		S.push(node);
	}

	public static void dfs(int node) {

		for (int i = 0; i < arr[node].size(); i++) {
			int k = arr[node].get(i);
			if (vis[k] == false) {
				vis[k] = true;
				dfs(k);
			}
		}
	}

	public static boolean chPrime(int r) {

		for (int i = 2; i * i <= r; i++) {
			if (r % i == 0)
				return false;
		}
		return true;
	}

	public static int len(long ai) {
		String temp = "" + ai;

		return temp.length();
	}

	public static int f_digit(long ai, int f) {
		String temp = "" + ai;

		return (temp.charAt(f) - '0');

	}

	public static int binary(int a[], int val) {

		int low = 0;
		int high = a.length;

		int mid = (low + high) / 2;
		while (high - low > 1) {
			if (a[mid] <= val) {
				low = mid;
			} else if (a[mid] > val)
				high = mid;

			mid = (low + high) / 2;
		}
		if (a[high] == val)
			return high;
		return low;
	}

	public static long mod = (long) Math.pow(10, 9) + 7;

	public static int bin(int a[], int val) {

		int low = 0;
		int high = a.length - 1;

		int mid = (low + high) / 2;

		while (high - low > 1) {
			if (a[mid] > val) {
				high = mid;
			} else
				low = mid;

			mid = (low + high) / 2;
		}

		return high;

	}

	public static int lcs(int a[]) {

		int size[] = new int[a.length];
		int arr[] = new int[a.length];
		Arrays.fill(arr, Integer.MAX_VALUE);
		size[0] = 1;
		arr[0] = a[0];
		int max = 1;
		for (int i = 1; i < a.length; i++) {
			int get = Arrays.binarySearch(arr, a[i]);
			if (get < 0) {
				get *= -1;
				get--;
			}

			size[i] = get + 1;
			arr[get] = a[i];
			max = Math.max(max, get + 1);
		}

		return max;
	}

	private static ArrayList<Integer> siev(int max) {
		boolean prime[] = new boolean[max + 1];
		ArrayList<Integer> ans = new ArrayList();
		for (int i = 2; i * i <= max; i++) {
			if (!prime[i]) {
				for (int j = i * i; j <= max; j += i)
					prime[j] = true;

			}
		}

		for (int i = 2; i <= max; i++)
			if (!prime[i])
				ans.add(i);

		return ans;

	}

	public static class in {
		static BufferedReader reader;
		static StringTokenizer tokenizer;

		static void init(InputStream input) {
			reader = new BufferedReader(new InputStreamReader(input));
			tokenizer = new StringTokenizer("");
		}

		static String next() throws IOException {
			while (!tokenizer.hasMoreTokens())
				tokenizer = new StringTokenizer(reader.readLine());
			return tokenizer.nextToken();
		}

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

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

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

	public static long dis(int x1, int y1, int x2, int y2) {

		return (long) (x1 - x2) * (long) (x1 - x2) + (long) (y1 - y2)
				* (long) (y1 - y2);
	}

	public static void main(String[] args) throws IOException {
		// BufferedReader in = new BufferedReader(new
		// InputStreamReader(System.in));
		// BufferedReader in = new BufferedReader(new FileReader(
		// "coding_contest_creation.txt"));
		// System.out.println(-70 % 3);
		// int aa[] = { 1, 2, 5 };
		// dsfdssdgsdgsggsafal;fksd;l
		// System.out.println(Arrays.binarySearch(aa, 2));
		// goooooooooog
		StringBuilder qq = new StringBuilder();
		// PrintWriter out = new PrintWriter(new
		// OutputStreamWriter(System.out));
		// PrintWriter out = new PrintWriter(new FileWriter("out.txt"));

		in.init(System.in);
		PrintWriter out = new PrintWriter(System.out);

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

		HashSet<Integer> setx = new HashSet();
		setx.add(x1);
		setx.add(x2);
		setx.add(x3);
		HashSet<Integer> sety = new HashSet();
		sety.add(y1);
		sety.add(y2);
		sety.add(y3);
		
		if (setx.size() == 1 || sety.size() == 1) {
			System.out.println(1);
			return;
		}
		if (setx.size() == 2) {
			if (x1 == x2 && (y3 <= Math.min(y1, y2) || y3 >= Math.max(y1, y2))) {
				System.out.println(2);
				return;
			} else if (x1 == x3 && (y2 <= Math.min(y1, y3)
					|| y2 >= Math.max(y1, y3))) {
				System.out.println(2);
				return;
			} else if (x2 == x3 && (y1 <= Math.min(y3, y2)
					|| y1 >= Math.max(y3, y2))) {
				System.out.println(2);
				return;
			}
		}

		if (sety.size() == 2) {
			if (y1 == y2 && (x3 <= Math.min(x1, x2) || x3 >= Math.max(x1, x2))) {
				System.out.println(2);
				return;
			} else if (y1 == y3 && (x2 <= Math.min(x1, x3)
					|| x2 >= Math.max(x1, x3))) {
				System.out.println(2);
				return;
			} else if (y2 == y3 && (x1 <= Math.min(x3, x2)
					|| x1 >= Math.max(x3, x2))) {
				System.out.println(2);
				return;
			}
		}
		System.out.println(3);

		out.close();

	}
}