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;
const long long mod = 1e9 + 7;
long long QPow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
const int MX = 1;
int vis[MX + 2];
int prim[MX + 2];
int top;
void init() {
  vis[0] = vis[1] = 1;
  for (int i = 2; i <= MX; i++) {
    if (!vis[i]) prim[top++] = i;
    for (int j = 0; j < top && prim[j] * i <= MX; j++) {
      vis[prim[j] * i] = 1;
      if (i % prim[j] == 0) break;
    }
  }
}
int vis1[MX + 2];
int prim1[MX + 2];
int top1;
void init1() {
  vis[0] = vis[1] = 1;
  int temp = 1;
  for (int i = 2; i <= MX; i++) {
    if (!vis[i]) {
      for (int j = 2; j * i <= MX; j++) {
        vis[j * i]++;
        temp = j;
        while (temp % i == 0) vis[j * i]++, temp /= i;
      }
      vis[i]++;
    }
  }
}
long long toInt(string str) {
  long long ans = 0;
  for (int i = 0; i < str.size(); i++) {
    ans *= 10;
    ans += str[i] - '0';
  }
  return ans;
}
string toString(long long a) {
  if (a == 0) return "0";
  string temp = "";
  long long tp = a;
  while (tp) {
    temp.push_back('0' + tp % 10);
    tp /= 10;
  }
  string temp2 = temp;
  for (int ii = 0; ii < temp.size(); ii++) {
    temp[ii] = temp2[temp.size() - 1 - ii];
  }
  return temp;
}
const int MAXN = 1;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int b[4][4];
int ans[4][4];
int md[4][4];
inline long long add(const long long &a, const long long &b) {
  return (a + b) >= mod ? (a + b) - mod : (a + b < 0 ? (a + b) + mod : a + b);
}
inline long long mul(const long long &a, const long long &b) {
  return 1LL * a * b % mod;
}
void matrixPow(int n) {
  while (n) {
    if (n & 1) {
      for (int i = 0; i < 4; i++)
        for (int j = 0; j < 4; j++) {
          md[i][j] = 0;
          for (int k = 0; k < 4; k++)
            md[i][j] = add(md[i][j], mul(ans[i][k], b[k][j]));
        }
      memcpy(ans, md, sizeof ans);
    }
    for (int i = 0; i < 4; i++)
      for (int j = 0; j < 4; j++) {
        md[i][j] = 0;
        for (int k = 0; k < 4; k++)
          md[i][j] = add(md[i][j], mul(b[i][k], b[k][j]));
      }
    memcpy(b, md, sizeof b);
    n >>= 1;
  }
}
inline void read(int &n) {
  char c = '+';
  bool flag = 0;
  n = 0;
  while (c < '0' || c > '9') {
    c = getchar();
    if (c == '-') flag = 1;
  }
  while (c >= '0' && c <= '9') n = n * 10 + c - 48, c = getchar();
}
int ans1[100005];
int xx[3], yy[3];
signed main() {
  ifstream in("Text.txt");
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  int n;
  int m;
  int x, y;
  map<int, int> cntx;
  map<int, int> cnty;
  for (int i = 0; i < 3; i++) {
    cin >> x >> y;
    xx[i] = x, yy[i] = y;
    cntx[x]++;
    cnty[y]++;
  }
  long long ans1 = 3;
  int xs = cntx.size();
  int ys = cnty.size();
  if (xs == 1 || ys == 1) {
    ans1 = 1;
  } else if (xs == 2 && ys == 3) {
    if (xx[0] == xx[1]) {
      if (yy[2] <= min(yy[0], yy[1]) || yy[2] >= max(yy[0], yy[1])) ans1--;
    } else if (xx[0] == xx[2]) {
      if (yy[1] <= min(yy[0], yy[2]) || yy[1] >= max(yy[0], yy[2])) ans1--;
    } else if (xx[1] == xx[2]) {
      if (yy[0] <= min(yy[2], yy[1]) || yy[0] >= max(yy[2], yy[1])) ans1--;
    }
  } else if (xs == 3 && ys == 2) {
    if (yy[0] == yy[1]) {
      if (xx[2] <= min(xx[0], xx[1]) || xx[2] >= max(xx[0], xx[1])) ans1--;
    } else if (yy[0] == yy[2]) {
      if (xx[1] <= min(xx[0], xx[2]) || xx[1] >= max(xx[0], xx[2])) ans1--;
    } else if (yy[1] == yy[2]) {
      if (xx[0] <= min(xx[2], xx[1]) || xx[0] >= max(xx[2], xx[1])) ans1--;
    }
  } else if (xs == 2 && ys == 2)
    ans1 = 2;
  cout << ans1;
  return 0;
}
