#include <iostream> #include <cmath> #include <algorithm> #include <vector> using namespace std; struct point { long long x,y; }; int n,c,cc,t; bool ok; point a[100000]; float dist(point a,point b) { return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } bool isosc(point a,point b,point c) { float d1=dist(a,b); float d2=dist(b,c); float d3=dist(a,c); return (d1==d2||d2==d3||d1==d3); } bool isok(point a,point b,point c) { if (!isosc(a,b,c)) return false; if (a.x==b.x && b.y==c.y) return true; if (a.x==c.x && b.y==c.y) return true; if (c.x==b.x && c.y==a.y) return true; if (a.x==b.x && c.y==a.y) return true; if (a.x==c.x && b.y==a.y) return true; if (a.y==b.y && a.x==c.x) return true; if (a.y==b.y && b.x==c.x) return true; return false; } bool comp(point a,point b) { return ((a.x!=b.x && a.y!=b.y)); } void af(point a,point b,point c) { cout<<a.x<<' '<<a.y<<'|'<<b.x<<' '<<b.y<<'|'<<c.x<<' '<<c.y<<'\n'; } long long abss(long long a) { if (a<0) return -a; return a; } void sort() { vector<point> A(a,a+n); sort(A.begin(),A.end(),comp); int i=0; for (std::vector<point>::iterator it=A.begin();it!=A.end();++it,++i) a[i]=*it; } int main() { cin>>n; for (int i=0;i<n;++i) cin>>a[i].x>>a[i].y; //sort(); for (int i=0;i<n;++i) for (int j=i+1;j<n;++j){ if (abss(a[i].x-a[j].x)==abss(a[i].y-a[j].y)) t=2; else if (a[i].x==a[j].x || a[i].y==a[j].y) t=4; else t=0; cc=0; for (int k=n-1;k>j && cc<t;--k) if (isok(a[i],a[j],a[k])){ c++; cc++; } } cout<<c; return 0; }