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

public class Main {

	static final int mod = (int) 1e9 + 7;

	public static void main(String[] args) {
		FasterScanner s = new FasterScanner();
		PrintWriter out = new PrintWriter(System.out);
		int n=3;
		Pairxy[] p = new Pairxy[3];
		for(int i=0;i<3;i++)
			p[i] = new Pairxy(s.nextInt(), s.nextInt());
		if(p[0].x == p[1].x && p[2].x==p[1].x) {
			System.out.println(1);
			return;
		}
		if(p[0].y == p[1].y && p[2].y==p[1].y) {
			System.out.println(1);
			return;
		}
		for(int i=0;i<6;i++){
			if(p[0].x==p[1].x && ( p[2].y>=Math.max(p[0].y,p[1].y) || p[2].y<=Math.min(p[1].y,p[0].y) ))
			{
				System.out.println(2);
				return;
			}
			if(p[0].y==p[1].y && ( p[2].x>=Math.max(p[0].x,p[1].x) || p[2].x<=Math.min(p[1].x,p[0].x) ))
			{
				System.out.println(2);
				return;
			}
			if(i%2==0){
				Pairxy tmp=p[1];
				p[1]=p[2];
				p[2]=tmp;
			}
			else{
				Pairxy tmp=p[0];
				p[0]=p[2];
				p[2]=tmp;
			}
		}
		
		System.out.println(3);
		
		out.close();

	}

	public static class Pairxy implements Comparable<Pairxy> {
		int x;
		int y;
		long dist = 0;
		long dist2 = 0;

		Pairxy(int x, int y) {
			this.x = x;
			this.y = y;
			dist = x * 1l * x + y * 1l * y;
		}

		public int compareTo(Pairxy o) {
			if (this.dist != o.dist)
				return Long.compare(this.dist, o.dist);
			else
				return Integer.compare(this.x, o.x);

		}

	}

	public static class Pair implements Comparable<Pair> {
		long val;
		int ind;

		Pair(long v, int i) {
			val = v;
			ind = i;
		}

		public int compareTo(Pair o) {
			if (this.val != o.val)
				return Long.compare(this.val, o.val);
			return Integer.compare(this.ind, o.ind);
		}
	}

	public static long C(int n, int r) {
		long ans = 1;
		int x = 1;
		while (x <= r) {
			ans *= n;
			ans /= x;
			x++;
			n--;
		}
		return ans;
	}

	public static long pow(long x, long n, int mod) {
		long res = 1;
		for (long p = x; n > 0; n >>= 1, p = (p * p) % mod) {
			if ((n & 1) != 0) {
				res = (int) (res * p % mod);
			}
		}
		return res;
	}

	public static class DisjointSetsRank {

		int[] p;
		int[] rank;

		public DisjointSetsRank(int size) {
			p = new int[size];
			for (int i = 0; i < size; i++)
				p[i] = i;
			rank = new int[size];
		}

		public int root(int x) {
			return x == p[x] ? x : (p[x] = root(p[x]));
		}

		public int sameSet(int x, int y) {
			if (root(x) == root(y))
				return 1;
			return 0;

		}

		public void unite(int a, int b) {
			a = root(a);
			b = root(b);
			if (a == b)
				return;

			if (rank[a] < rank[b]) {
				p[a] = b;
			} else {
				p[b] = a;
				if (rank[a] == rank[b])
					++rank[a];
			}
		}

		public static void main(String[] args) {
			DisjointSetsRank ds = new DisjointSetsRank(10);
			System.out.println(false == (ds.root(0) == ds.root(9)));
			ds.unite(0, 9);
			System.out.println(true == (ds.root(0) == ds.root(9)));
		}
	}

	static int gcd(long m, long n) {
		long x;
		long y;
		while (m % n != 0) {
			x = n;
			y = m % n;
			m = x;
			n = y;
		}
		return (int) n;
	}

	public static class st {

		int n;
		long[] val;
		int[] index;

		void build(long[] t) { // build the tree
			this.n = t.length;
			val = new long[2 * n];
			index = new int[2 * n];

			for (int i = 0; i < n; i++) {
				val[n + i] = t[i];
				index[n + i] = i;
			}
			for (int i = n - 1; i >= 0; i--) {
				if (val[2 * i] > val[2 * i + 1]) {
					val[i] = val[2 * i];
					index[i] = index[2 * i];
				} else {
					val[i] = val[2 * i + 1];
					index[i] = index[2 * i + 1];
				}
			}
		}

		int query(int l, int r) { // sum on interval [l, r)
			int res = 0;
			long max = 0;
			for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
				if ((l & 1) != 0) {
					if (val[l] > max) {
						max = val[l];
						res = index[l];
					}
					l++;
				}
				if ((r & 1) != 0) {
					--r;
					if (val[r] > max) {
						max = val[r];
						res = index[r];
					}
				}
			}
			return res;
		}
	}

	public static class FasterScanner {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int snumChars;

		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = System.in.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		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 String nextString() {
			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 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 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 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;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}
}