#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
  int id;
  node() {}
  node(int _x, int _y, int _id) {
    x = _x;
    y = _y;
    id = _id;
  }
};
vector<node> xx[2005];
vector<node> yy[2005];
bool cmp1(const node &a, const node &b) { return a.x < b.x; }
bool cmp2(const node &a, const node &b) { return a.y < b.y; }
int main() {
  int n;
  int a, b;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a, &b);
    a += 1000, b += 1000;
    xx[a].push_back(node(a, b, i));
    yy[b].push_back(node(a, b, i));
  }
  for (int i = 0; i <= 2000; i++) {
    sort(xx[i].begin(), xx[i].end(), cmp2);
    sort(yy[i].begin(), yy[i].end(), cmp1);
  }
  int ans = 0;
  int lx, ly;
  int y;
  for (int i = 0; i <= 2000; i++) {
    lx = xx[i].size();
    if (lx >= 3) {
      for (int j = 1; j < lx - 1; j++) {
        y = xx[i][j].y;
        ly = yy[y].size();
        if (ly >= 3 && yy[y][0].x < xx[i][j].x && xx[i][j].x < yy[y][ly - 1].x)
          ans++;
      }
    }
  }
  printf("%d\n", ans);
}
