#include <bits/stdc++.h>
using namespace std;
struct duy {
  long long x, y;
};
bool cmp1(duy a, duy b) {
  if (a.x == b.x)
    return a.y < b.y;
  else
    return a.x < b.x;
}
bool cmp2(duy a, duy b) {
  if (a.y == b.y)
    return a.x < b.x;
  else
    return a.y < b.y;
}
duy a[1001];
duy b[1001];
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i].x >> a[i].y;
    b[i].x = a[i].x;
    b[i].y = a[i].y;
  }
  sort(a + 1, a + n + 1, cmp1);
  sort(b + 1, b + n + 1, cmp2);
  long long dem = 0;
  for (long long i = 2; i < n; i++) {
    if (a[i - 1].x == a[i].x && a[i - 1].y < a[i].y && a[i + 1].x == a[i].x &&
        a[i + 1].y > a[i].y) {
      for (long long j = 2; j < n; j++) {
        if (b[j].x == a[i].x && b[j].y == a[i].y) {
          if (b[j - 1].y == b[j].y && b[j - 1].x < b[j].x &&
              b[j + 1].y == b[j].y && b[j + 1].x > b[j].x)
            dem++;
        }
      }
    }
  }
  cout << dem;
}
