#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x, y, x1, y1, x2, y2;
  cin >> x >> y;
  cin >> x1 >> y1;
  cin >> x2 >> y2;
  if ((x == x1 && x == x2) || (y == y1 && y == y2))
    cout << "1" << endl;
  else {
    if (x == x1 && ((y2 - y1) * (y2 - y) >= 0)) {
      cout << "2" << endl;
    } else if (x == x2 && ((y1 - y2) * (y1 - y) >= 0)) {
      cout << "2" << endl;
    } else if (x2 == x1 && ((y - y1) * (y - y2) >= 0)) {
      cout << "2" << endl;
    } else if (y == y1 && ((x2 - x1) * (x2 - x) >= 0)) {
      cout << "2" << endl;
    } else if (y == y2 && ((x1 - x2) * (x1 - x) >= 0)) {
      cout << "2" << endl;
    } else if (y2 == y1 && ((x - x1) * (x - x2) >= 0)) {
      cout << "2" << endl;
    } else
      cout << "3" << endl;
  }
  return 0;
}
