#include <bits/stdc++.h>
const double pi = 3.14159265359;
const int INF = 0x3f3f3f3f;
using namespace std;
int main(void) {
  vector<int> x, y;
  map<int, set<int> > xx, yy;
  int n, temp1, temp2, count = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> temp1 >> temp2;
    x.push_back(temp1), y.push_back(temp2);
    xx[temp1].insert(temp2);
    yy[temp2].insert(temp1);
  }
  for (int i = 0; i <= n - 1; i++) {
    if (xx[x[i]].find(y[i]) != --(xx[x[i]].end()) &&
        xx[x[i]].find(y[i]) != xx[x[i]].begin() &&
        yy[y[i]].find(x[i]) != --(yy[y[i]].end()) &&
        yy[y[i]].find(x[i]) != yy[y[i]].begin())
      count++;
  }
  cout << count << "\n";
  return 0;
}
