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;
using Int = long long;
constexpr static int mod = 1e9 + 7;
constexpr static int inf = (1 << 30) - 1;
constexpr static Int infll = (1LL << 61) - 1;
int Competitive_Programming =
    (ios_base::sync_with_stdio(false), cin.tie(nullptr),
     cout << fixed << setprecision(15), 0);
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const long double EPS = 1e-9, PI = acos(-1);
template <typename ftype>
inline bool eq(ftype a, ftype b) {
  return fabs(b - a) < EPS;
}
template <typename ftype>
struct point2d {
  ftype x, y;
  point2d() {}
  point2d(ftype x, ftype y) : x(x), y(y){};
  point2d operator+(const point2d &t) const { return point2d(*this) += t; }
  point2d operator-(const point2d &t) const { return point2d(*this) -= t; }
  point2d operator*(ftype t) const { return point2d(*this) *= t; }
  point2d operator/(ftype t) const { return point2d(*this) /= t; }
  point2d &operator+=(const point2d &t) {
    x += t.x;
    y += t.y;
    return *this;
  }
  point2d &operator-=(const point2d &t) {
    x -= t.x;
    y -= t.y;
    return *this;
  }
  point2d &operator*=(ftype t) {
    x *= t;
    y *= t;
    return *this;
  }
  point2d &operator/=(ftype t) {
    x /= t;
    y /= t;
    return *this;
  }
  friend istream &operator>>(istream &is, point2d<ftype> &p) {
    ftype a, b;
    is >> a >> b;
    p = point2d<ftype>(a, b);
    return is;
  }
  friend ostream &operator<<(ostream &os, point2d<ftype> &p) {
    return os << p.x << " " << p.y;
  }
  bool operator==(const point2d &p) const { return eq(x, p.x) and eq(y, p.y); }
  bool operator!=(const point2d &p) const {
    return (not eq(x, p.x)) or (not eq(y, p.y));
  }
};
bool on_line(tuple<point2d<int>, point2d<int>> &l, point2d<int> &pt) {
  auto [x1, y1] = get<0>(l);
  auto [x2, y2] = get<1>(l);
  if (x1 == x2) {
    return min(y1, y2) <= pt.y and pt.y <= max(y1, y2) and pt.x == x1;
  }
  if (y1 == y2) {
    return min(x1, x2) <= pt.x and pt.x <= max(x1, x2) and pt.y == y1;
  }
  return false;
}
int main() {
  int N = 3;
  vector<int> x(3), y(3);
  vector<point2d<int>> pt;
  for (int i = 0; i < 3; i++) {
    cin >> x[i] >> y[i];
    pt.emplace_back(x[i], y[i]);
  }
  vector<tuple<point2d<int>, point2d<int>>> line;
  vector<point2d<int>> pts;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) pts.emplace_back(x[i], y[j]);
  }
  for (int i = 0; i < pts.size(); i++) {
    for (int j = 0; j < pts.size(); j++) {
      if (i == j) continue;
      auto [x1, y1] = pts[i];
      auto [x2, y2] = pts[j];
      if (x1 == x2 or y1 == y2) line.emplace_back(pts[i], pts[j]);
    }
  }
  int ans = 3;
  for (int i = 0; i < line.size(); i++) {
    for (int j = 0; j < line.size(); j++) {
      bool ok = true;
      if (get<0>(line[i]) != get<0>(line[j])) continue;
      for (int k = 0; k < N; k++)
        ok &= on_line(line[i], pt[k]) or on_line(line[j], pt[k]);
      if (ok) ans = 2;
    }
  }
  for (int i = 0; i < line.size(); i++) {
    if (on_line(line[i], pt[0]) and on_line(line[i], pt[1]) and
        on_line(line[i], pt[2]))
      ans = 1;
  }
  cout << ans << "\n";
}
