#include <iostream>
#include <bits/stdc++.h>

using namespace std;

struct Tacka {
  int x,y;
};

bool compare_by_x (Tacka t1, Tacka t2) {
  return t1.x < t2.x;
}

bool compare_by_y (Tacka t1, Tacka t2) {
  return t1.y < t2.y;
}

int main() {
  int n,i,j,np = 0;
  cin >> n;
  Tacka tacke[n];
  vector<int> dx;
  vector<int> dy;
  vector<float> d;

  for (i = 0; i < n; i ++) {
    cin >> tacke[i].x >> tacke[i].y;
  }

  sort (tacke, tacke + n, compare_by_x);
  for (i = 0; i < n-1; i++) {
    for (j = 0; j < n-1; j++){
      if (tacke[i].x == tacke[i+1].x) {
        if (abs(tacke[i+1].y - tacke[i].y) == 2 * abs(tacke[j+1].y - tacke[j].y)) np++;
        //if (abs(tacke[j+1].y - tacke[j].y) == 2 * abs(tacke[i+1].y - tacke[i].y)) np++;
    }
    }
  }

  sort(tacke, tacke + n, compare_by_y);
  for (i = 0; i < n-1; i++) {
    for (j = 0; j < n-1; j++){
      if (tacke[i].y == tacke[i+1].y) {
        if (abs(tacke[i+1].x - tacke[i].x) == 2 * abs(tacke[j+1].x - tacke[j].x)) np++;
        //if (abs(tacke[j+1].x - tacke[j].x) == 2 * abs(tacke[i+1].x - tacke[i].x)) np++;
    }
    }
  }


  cout << np;

}