#include <bits/stdc++.h>
using namespace std;
int n;
struct Point {
  int x, y, i, f;
};
Point pt[20001];
bool cmp1(Point &a, Point &b) {
  if (a.x == b.x) return a.y < b.y;
  return a.x < b.x;
}
bool cmp2(Point &a, Point &b) {
  if (a.y == b.y) return a.x < b.x;
  return a.y < b.y;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &pt[i].x, &pt[i].y);
    pt[i].i = i, pt[i].f = 0;
  }
  sort(pt, pt + n, cmp1);
  for (int i = 1; i < n - 1; ++i) {
    if (pt[i - 1].x == pt[i].x && pt[i + 1].x == pt[i].x) pt[i].f |= 1;
  }
  sort(pt, pt + n, cmp2);
  for (int i = 1; i < n - 1; ++i) {
    if (pt[i - 1].y == pt[i].y && pt[i + 1].y == pt[i].y) pt[i].f |= 2;
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) ans += (pt[i].f == 3);
  printf("%d\n", ans);
  return 0;
}
