#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.second == b.second) {
    return (a.first < b.first);
  } else {
    return (a.second < b.second);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  vector<pair<int, int>> v, vx;
  int n;
  cin >> n;
  int x, y;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    v.push_back({x, y});
  }
  sort(v.begin(), v.end());
  for (int i = 1; i < n - 1; i++) {
    if (v[i].first == v[i - 1].first && v[i].first == v[i + 1].first) {
      vx.push_back(v[i]);
    }
  }
  sort(vx.begin(), vx.end(), sortbysec);
  sort(v.begin(), v.end(), sortbysec);
  int j = 0, count = 0, limit = vx.end() - vx.begin();
  for (int i = 0; i < n; i++) {
    if (j < limit) {
      if (vx[j] == v[i]) {
        if (i > 0 && i < n - 1) {
          if (v[i].second == v[i - 1].second &&
              v[i].second == v[i + 1].second) {
            count++;
          }
        }
        j++;
      }
    }
  }
  cout << count << endl;
}
