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>
#include <bits/stdc++.h>
using namespace std;
void file() {}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long setbit(long long num, int idx, int val = 1) {
  return (val) ? (num | (1 << idx)) : (num & ~(1 << idx));
}
long long getbit(long long num, int idx) { return ((num >> idx) & 1) == 1; }
int contbit(int num) {
  int ret = 0;
  while (num) {
    if (num % 2) ret++;
    num /= 2;
  }
  return ret;
}
int dx[] = {-1, 0, 0, 1, 1, 1, -1, -1};
int dy[] = {0, 1, -1, 0, 1, -1, 1, -1};
int dcmp(double x, double y) {
  return fabs(x - y) <= 1e-6 ? 0 : x < y ? -1 : 1;
}
namespace std {
bool operator<(const complex<long double>& a, const complex<long double>& b) {
  return dcmp(a.real(), b.real()) == -1  ? 1
         : dcmp(a.real(), b.real()) == 1 ? 0
         : dcmp(a.imag(), b.imag()) != 1 ? 1
                                         : 0;
}
bool operator>(const complex<long double>& a, const complex<long double>& b) {
  return dcmp(a.real(), b.real()) == 1    ? 1
         : dcmp(a.real(), b.real()) == -1 ? 0
         : dcmp(a.imag(), b.imag()) != -1 ? 1
                                          : 0;
}
}  // namespace std
bool comPoints(complex<long double> a, complex<long double> b) {
  if (dcmp(a.real(), b.real())) return dcmp(a.real(), b.real()) == -1;
  return dcmp(a.imag(), b.imag()) == -1;
}
complex<long double> readPoint() {
  long double x, y;
  cin >> x >> y;
  return complex<long double>(x, y);
}
void printPoint(complex<long double> P) {
  cout << (int)P.real() << " " << (int)P.imag();
}
double fixDoubleMod(double a, double k) { return fmod(fmod(a, k) + k, k); }
bool pointOnLine(complex<long double> a, complex<long double> b,
                 complex<long double> p) {
  return fabs(((conj(((b) - (a))) * (((p) - (a)))).imag())) < 1e-6;
}
int getMinNumOfSegments(vector<complex<long double> >& a) {
  if (pointOnLine(a[0], a[1], a[2])) return 1;
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) {
      if (i != j && dcmp(a[i].imag(), a[j].imag()) == 0 &&
          (a[3 - i - j].real() >= max(a[i].real(), a[j].real()) ||
           a[3 - i - j].real() <= min(a[i].real(), a[j].real())))
        return 2;
      if (i != j && dcmp(a[i].real(), a[j].real()) == 0 &&
          (a[3 - i - j].imag() >= max(a[i].imag(), a[j].imag()) ||
           a[3 - i - j].imag() <= min(a[i].imag(), a[j].imag())))
        return 2;
    }
  return 3;
}
int main() {
  file();
  fast();
  vector<complex<long double> > a(3);
  for (int i = 0; i < 3; i++) a[i] = readPoint();
  cout << getMinNumOfSegments(a);
}
