#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0), ios_base::sync_with_stdio(0), cin.tie(0),
      cout.tie(0);
  ;
  pair<long long, long long> a[3];
  unordered_map<long long, int> stx, sty;
  for (int i = 0; i < 3; ++i) {
    cin >> a[i].first >> a[i].second;
    stx[a[i].first]++;
    sty[a[i].second]++;
  }
  if (stx.size() == 1 && sty.size() == 1) return cout << 0 << "\n", 0;
  ;
  if (stx.size() == 1 || sty.size() == 1) return cout << 1 << "\n", 0;
  ;
  if (sty.size() == 2) {
    int x3;
    for (int i = 0; i < 3; ++i) {
      if (sty[a[i].second] == 1) {
        x3 = a[i].first;
      }
    }
    int is1 = 0, is2 = 0;
    for (int i = 0; i < 3; ++i) {
      if (sty[a[i].second] == 2) {
        if (x3 <= a[i].first) is1++;
        if (x3 >= a[i].first) is2++;
      }
    }
    if (is1 == 2 || is2 == 2) return cout << 2 << "\n", 0;
    ;
  }
  if (stx.size() == 2) {
    int x3;
    for (int i = 0; i < 3; ++i) {
      if (stx[a[i].first] == 1) {
        x3 = a[i].second;
      }
    }
    int is1 = 0, is2 = 0;
    for (int i = 0; i < 3; ++i) {
      if (stx[a[i].first] == 2) {
        if (x3 <= a[i].second)
          is1++;
        else if (x3 >= a[i].second)
          is2++;
      }
    }
    if (is1 == 2 || is2 == 2) return cout << 2 << "\n", 0;
    ;
  }
  return cout << 3 << "\n", 0;
  ;
  return 0;
}
