#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
using namespace std;
const int MAXN = 200010;

int n, m, d[MAXN], dp[MAXN], r1, r2;
vector <int> adj[MAXN];

void dfs(int v, int depth) {
    int len = adj[v].size(), u;
    dp[v] = m;
    if (len == 0) return ;
    if (depth & 1) {
        dp[v] = 1;
    } else {
        dp[v] = m;
    }
    for (int i = 0; i < len; i++) {
        u = adj[v][i];
        dfs(u, depth + 1);
        if (depth & 1) {
            dp[v] = max(dp[v], dp[u]);
        } else {
            dp[v] = min(dp[v], dp[u]);
        }
    }
    if (!(depth & 1)) {
        dp[v] -= (len - 1);
    }
}

void dfs2(int v, int depth) {
    int len = adj[v].size(), u;
    dp[v] = 1;
    if (len == 0) return ;
    if (depth & 1) {
        dp[v] = 1;
    } else {
        dp[v] = m;
    }
    for (int i = 0; i < len; i++) {
        u = adj[v][i];
        dfs2(u, depth + 1);
        if (depth & 1) {
            dp[v] = max(dp[v], dp[u]);
        } else {
            dp[v] = min(dp[v], dp[u]);
        }
    }
    if (depth & 1) {
        dp[v] += (len - 1);
    }
}

int main() {
    //freopen("test.in", "r", stdin);
    scanf("%d", &n);
    for (int i = 0; i < n - 1; i++) {
        int v, u;
        scanf("%d%d", &v, &u);
        adj[v].push_back(u);
        d[v]++;
    }
    for (int i = 1; i <= n; i++) if (d[i] == 0) m++;
    dfs(1, 1);
    r1 = max(1, dp[1]);
    memset(dp, 0, sizeof(dp));
    dfs2(1, 1);
    r2 = min(m, dp[1]);
    printf("%d %d\n", r1, r2);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=200200;
int n,last[N]={},next[N]={},end[N]={},total_edge=0;
int size[N]={},f[N][2]={},g[N][2]={};
inline void add_edge(int u,int v)
{
	next[++total_edge]=last[u];
	last[u]=total_edge;
	end[total_edge]=v;
}
void init()
{
	scanf("%d",&n);
	for(int i=2,u=0,v=0;i<=n;++i)
	{
		scanf("%d%d",&u,&v);
		add_edge(u,v);
	}
}
void dfs(int s)
{
	size[s]=!last[s];
	for(int i=last[s];i;i=next[i])
	{
		dfs(end[i]);
		size[s]+=size[end[i]];
	}
}
void get_ans1(int s,int c)
{
	if(!last[s])
	{
		f[s][c]=1;
		return;
	}
	f[s][c]=0;
	for(int i=last[s];i;i=next[i])
		get_ans1(end[i],!c);
	if(c==0)
		for(int i=last[s];i;i=next[i])
			f[s][c]=max(f[s][c],size[s]-size[end[i]]+f[end[i]][!c]);
	else
		for(int i=last[s];i;i=next[i])
			f[s][c]=max(f[s][c],f[end[i]][!c]);
}
void get_ans2(int s,int c)
{
	if(!last[s])
	{
		g[s][c]=1;
		return;
	}
	g[s][c]=n;
	for(int i=last[s];i;i=next[i])
		get_ans2(end[i],!c);
	if(c==0)
		for(int i=last[s];i;i=next[i])
			g[s][c]=min(g[s][c],size[s]-size[end[i]]+g[end[i]][!c]);
	else
		for(int i=last[s];i;i=next[i])
			g[s][c]=min(g[s][c],g[end[i]][!c]);
}
void work()
{
	dfs(1);
	for(int i=1;i<=n;++i)
		cout<<size[i]<<' ';
	cout<<endl;
	get_ans1(1,0);
	get_ans2(1,0);
	cout<<f[1][0]<<' '<<g[1][0]<<endl;
}
int main()
{
	init();
	work();
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=200200;
int n,last[N]={},next[N]={},end[N]={},total_edge=0;
int size[N]={},f[N][2]={},g[N][2]={};
inline void add_edge(int u,int v)
{
	next[++total_edge]=last[u];
	last[u]=total_edge;
	end[total_edge]=v;
}
void init()
{
	scanf("%d",&n);
	for(int i=2,u=0,v=0;i<=n;++i)
	{
		scanf("%d%d",&u,&v);
		add_edge(u,v);
	}
}
void dfs(int s)
{
	size[s]=!last[s];
	for(int i=last[s];i;i=next[i])
	{
		dfs(end[i]);
		size[s]+=size[end[i]];
	}
}
void get_ans1(int s,int c)
{
	if(!last[s])
	{
		f[s][c]=1;
		return;
	}
	f[s][c]=1;
	for(int i=last[s];i;i=next[i])
		get_ans1(end[i],!c);
	if(c==0)
		for(int i=last[s];i;i=next[i])
			f[s][c]=max(f[s][c],size[s]-size[end[i]]+f[end[i]][!c]);
	else
		for(int i=last[s];i;i=next[i])
			f[s][c]+=f[end[i]][!c]-1;
}
void get_ans2(int s,int c)
{
	if(!last[s])
	{
		g[s][c]=1;
		return;
	}
	g[s][c]=size[s];
	for(int i=last[s];i;i=next[i])
		get_ans2(end[i],!c);
	if(c==0)
		for(int i=last[s];i;i=next[i])
			g[s][c]-=size[end[i]]-g[end[i]][!c];
	else
		for(int i=last[s];i;i=next[i])
			g[s][c]=min(g[s][c],g[end[i]][!c]);
}
void work()
{
	dfs(1);
	get_ans1(1,0);
	get_ans2(1,0);
	cout<<f[1][0]<<' '<<g[1][0]<<endl;
}
int main()
{
	init();
	work();
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=200200;
int n,last[N]={},next[N]={},end[N]={},total_edge=0;
int size[N]={},f[N][2]={},g[N][2]={};
inline void add_edge(int u,int v)
{
	next[++total_edge]=last[u];
	last[u]=total_edge;
	end[total_edge]=v;
}
void init()
{
	scanf("%d",&n);
	for(int i=2,u=0,v=0;i<=n;++i)
	{
		scanf("%d%d",&u,&v);
		add_edge(u,v);
	}
}
void dfs(int s)
{
	size[s]=!last[s];
	for(int i=last[s];i;i=next[i])
	{
		dfs(end[i]);
		size[s]+=size[end[i]];
	}
}
void get_ans1(int s,int c)
{
	if(!last[s])
	{
		f[s][c]=1;
		return;
	}
	f[s][c]=0;
	for(int i=last[s];i;i=next[i])
		get_ans1(end[i],!c);
	if(c==0)
		for(int i=last[s];i;i=next[i])
			f[s][c]=max(f[s][c],size[s]-size[end[i]]+f[end[i]][!c]);
	else
		for(int i=last[s];i;i=next[i])
			f[s][c]+=f[end[i]][!c]-1;
}
void get_ans2(int s,int c)
{
	if(!last[s])
	{
		g[s][c]=1;
		return;
	}
	g[s][c]=size[s];
	for(int i=last[s];i;i=next[i])
		get_ans2(end[i],!c);
	if(c==0)
		for(int i=last[s];i;i=next[i])
			g[s][c]-=size[end[i]]-g[end[i]][!c];
	else
		for(int i=last[s];i;i=next[i])
			g[s][c]=min(g[s][c],g[end[i]][!c]);
}
void work()
{
	dfs(1);
	get_ans1(1,0);
	get_ans2(1,0);
	cout<<f[1][0]<<' '<<g[1][0]<<endl;
}
int main()
{
	init();
	work();
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=200200;
int n,last[N]={},next[N]={},end[N]={},total_edge=0;
int size[N]={},f[N][2]={},g[N][2]={};
inline void add_edge(int u,int v)
{
	next[++total_edge]=last[u];
	last[u]=total_edge;
	end[total_edge]=v;
}
void init()
{
	scanf("%d",&n);
	for(int i=2,u=0,v=0;i<=n;++i)
	{
		scanf("%d%d",&u,&v);
		add_edge(u,v);
	}
}
void dfs(int s)
{
	size[s]=!last[s];
	for(int i=last[s];i;i=next[i])
	{
		dfs(end[i]);
		size[s]+=size[end[i]];
	}
}
void get_ans1(int s,int c)
{
	if(!last[s])
	{
		f[s][c]=1;
		return;
	}
	f[s][c]=0;
	for(int i=last[s];i;i=next[i])
		get_ans1(end[i],!c);
	if(c==0)
		for(int i=last[s];i;i=next[i])
			f[s][c]=max(f[s][c],size[s]-size[end[i]]+f[end[i]][!c]);
	else
		for(int i=last[s];i;i=next[i])
			f[s][c]=max(f[s][c],f[end[i]][!c]);
}
void get_ans2(int s,int c)
{
	if(!last[s])
	{
		g[s][c]=1;
		return;
	}
	g[s][c]=n;
	for(int i=last[s];i;i=next[i])
		get_ans2(end[i],!c);
	if(c==0)
		for(int i=last[s];i;i=next[i])
			g[s][c]=min(g[s][c],size[s]-size[end[i]]+g[end[i]][!c]);
	else
		for(int i=last[s];i;i=next[i])
			g[s][c]=min(g[s][c],g[end[i]][!c]);
}
void work()
{
	dfs(1);
	get_ans1(1,0);
	get_ans2(1,0);
	cout<<f[1][0]<<' '<<g[1][0]<<endl;
}
int main()
{
	init();
	work();
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

vector < int > q[200005];
int ans[200005][5],one,two,i,j,x,y,n,leaf,siz[200005],shv[200005];

void go(int z)
{
     for (int j=0;j<q[z].size();j++)
      {
        go(q[z][j]);
        siz[z]+=siz[q[z][j]];
      }

      if (q[z].size()==0)
        {
            ans[z][1]=1;
            ans[z][2]=1;
            leaf++;
            siz[z]=1;
            return;
        }

      one=1000000000;
      two=0;
     for (int j=0;j<q[z].size();j++)
      {
         one=min(one, ans[q[z][j]][2]  );
         two+=ans[q[z][j]][1];
      }
      ans[z][1]=one;
      ans[z][2]=two;

}

void go1(int z)
{
     for (int j=0;j<q[z].size();j++)
      go1(q[z][j]);

      if (q[z].size()==0)
        {
            ans[z][1]=1;
            ans[z][2]=1;
            return;
        }

      one=000000;
      two=0;
     for (int j=0;j<q[z].size();j++)
      {
         one+= ans[q[z][j]][2]  ;
         two=max(two, ans[q[z][j]][1] + siz[z]-siz[q[z][j]]);
      }
      ans[z][1]=one-shv[z]+1;
      ans[z][2]=two;

}

main()
{
   cin>>n;

     for (i=1;i<n;i++)
      {
         cin>>x>>y;
         shv[x]++;
         q[x].push_back(y);
      }

     go(1);
     cout<<leaf-ans[1][1]+1<<endl;

     go1(1);

      cout<<leaf-ans[1][1]+1<<endl;

}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

vector < int > q[100005];
int ans[100005][5],one,two,i,j,x,y,n,leaf,siz[100005],shv[100005];

void go(int z)
{
     for (int j=0;j<q[z].size();j++)
      {
        go(q[z][j]);
        siz[z]+=siz[q[z][j]];
      }

      if (q[z].size()==0)
        {
            ans[z][1]=1;
            ans[z][2]=1;
            leaf++;
            siz[z]=1;
            return;
        }

      one=1000000000;
      two=0;
     for (int j=0;j<q[z].size();j++)
      {
         one=min(one, ans[q[z][j]][2]  );
         two+=ans[q[z][j]][1];
      }
      ans[z][1]=one;
      ans[z][2]=two;

}

void go1(int z)
{
     for (int j=0;j<q[z].size();j++)
      go1(q[z][j]);

      if (q[z].size()==0)
        {
            ans[z][1]=1;
            ans[z][2]=1;
            return;
        }

      one=000000;
      two=0;
     for (int j=0;j<q[z].size();j++)
      {
         one+= ans[q[z][j]][2]  ;
         two=max(two, ans[q[z][j]][1] + siz[z]-siz[q[z][j]]);
      }
      ans[z][1]=one-shv[z]+1;
      ans[z][2]=two;

}

main()
{
   cin>>n;

     for (i=1;i<n;i++)
      {
         cin>>x>>y;
         shv[x]++;
         q[x].push_back(y);
      }

     go(1);
     cout<<leaf-ans[1][1]+1<<endl;

     go1(1);

      cout<<leaf-ans[1][1]+1<<endl;

}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

vector < int > q[100005];
int ans[100005][5],one,two,i,j,x,y,n,leaf,siz[100005],shv[100005];

void go(int z)
{
     for (int j=0;j<q[z].size();j++)
      {
        go(q[z][j]);
        siz[z]+=siz[q[z][j]];
      }

      if (q[z].size()==0)
        {
            ans[z][1]=1;
            ans[z][2]=1;
            leaf++;
            siz[z]=1;
            return;
        }

      one=1000000000;
      two=0;
     for (int j=0;j<q[z].size();j++)
      {
         one=min(one, ans[q[z][j]][2]  );
         two=ans[q[z][j]][1];
      }
      ans[z][1]=one;
      ans[z][2]=two;

}

void go1(int z)
{
     for (int j=0;j<q[z].size();j++)
      go1(q[z][j]);

      if (q[z].size()==0)
        {
            ans[z][1]=1;
            ans[z][2]=1;
            return;
        }

      one=000000;
      two=0;
     for (int j=0;j<q[z].size();j++)
      {
         one+= ans[q[z][j]][2]  ;
         two=max(two, ans[q[z][j]][1] + siz[z]-siz[q[z][j]]);
      }
      ans[z][1]=one-shv[z]+1;
      ans[z][2]=two;

}

main()
{
   cin>>n;

     for (i=1;i<n;i++)
      {
         cin>>x>>y;
         shv[x]++;
         q[x].push_back(y);
      }

     go(1);
     cout<<leaf-ans[1][1]+1<<endl;

     go1(1);

      cout<<leaf-ans[1][1]+1<<endl;

}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <map>
#include <set>
#include <string>

using namespace std;

#define PII pair<int,int>
#define MP make_pair
#define FI first
#define SE second
#define PB push_back
#define lid (id << 1)
#define rid (id << 1 | 1)
#define MID(a, b) ((a + b) >> 1)

const int N = 200010;
const int INF = 1000000000;
const long long Mod = 1000000007;

int sz[N], dp[N], n;
vector<int> edge[N];

void dfs1(int u, int fa, int k) {
    int K = edge[u].size();
    if(K == 1) {
        sz[u] = 1;
        dp[u] = 0;
        return;
    }
    sz[u] = 0;
    int sum = 0;
    for(int i = 0; i < K; i++) {
        int v = edge[u][i];
        if(v == fa) continue;
        dfs1(v, u, k ^ 1);
        sz[u] += sz[v];
        sum += dp[v];
    }
    if(k == 1) {
        int tot = sz[u];
        dp[u] = 0;
        for(int i = 0; i < K; i++) {
            int v = edge[u][i];
            if(v == fa) continue;
            dp[u] = max(dp[u], tot - sz[v] + dp[v]);
        }
    }
    else {
        dp[u] = sum;
    }
}

void dfs2(int u, int fa, int k) {
    int K = edge[u].size();
    if(K == 1) {
        sz[u] = 1;
        dp[u] = 0;
        return;
    }
    sz[u] = 0;
    int sum = 0;
    for(int i = 0; i < K; i++) {
        int v = edge[u][i];
        if(v == fa) continue;
        dfs1(v, u, k ^ 1);
        sz[u] += sz[v];
        sum += dp[v] + 1;
    }
    if(k == 1) {
        dp[u] = sum - 1;
    }
    else {
        dp[u] = sz[u] - 1;
        for(int i = 0; i < K; i++) {
            int v = edge[u][i];
            if(v == fa) continue;
            dp[u] = min(dp[u], dp[v]);
        }
    }
}

int main() {
    scanf("%d", &n);
    for(int i = 1; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        edge[x].push_back(y);
        edge[y].push_back(x);
    }
    dfs1(1, 0, 1);
    printf("%d ", dp[1] + 1);
    dfs2(1, 0, 1);
    printf("%d\n", dp[1] + 1);
    return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <map>
#include <set>
#include <string>

using namespace std;

#define PII pair<int,int>
#define MP make_pair
#define FI first
#define SE second
#define PB push_back
#define lid (id << 1)
#define rid (id << 1 | 1)
#define MID(a, b) ((a + b) >> 1)

const int N = 200010;
const int INF = 1000000000;
const long long Mod = 1000000007;

int sz[N], dp[N], n;
vector<int> edge[N];

void dfs1(int u, int k) {
    int K = edge[u].size();
    if(K == 0) {
        sz[u] = 1;
        dp[u] = 0;
        return;
    }
    sz[u] = 0;
    int sum = 0;
    for(int i = 0; i < K; i++) {
        int v = edge[u][i];
        dfs1(v, k ^ 1);
        sz[u] += sz[v];
        sum += dp[v];
    }
    if(k == 1) {
        int tot = sz[u];
        dp[u] = 0;
        for(int i = 0; i < K; i++) {
            int v = edge[u][i];
            dp[u] = max(dp[u], tot - sz[v] + dp[v]);
        }
    }
    else {
        dp[u] = sum;
    }
}

void dfs2(int u, int k) {
    int K = edge[u].size();
    if(K == 0) {
        sz[u] = 1;
        dp[u] = 0;
        return;
    }
    sz[u] = 0;
    int sum = 0;
    for(int i = 0; i < K; i++) {
        int v = edge[u][i];
        dfs2(v, k ^ 1);
        sz[u] += sz[v];
        sum += dp[v] + 1;
    }
    if(k == 1) {
        dp[u] = sum - 1;
    }
    else {
        dp[u] = sz[u] - 1;
        for(int i = 0; i < K; i++) {
            int v = edge[u][i];
            dp[u] = min(dp[u], dp[v]);
        }
    }
}

int main() {
    scanf("%d", &n);
    for(int i = 1; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        edge[x].push_back(y);
    }
    dfs1(1, 1);
    printf("%d ", dp[1] + 1);
    dfs2(1, 1);
    printf("%d\n", dp[1] + 1);
    return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <map>
#include <set>
#include <string>

using namespace std;

#define PII pair<int,int>
#define MP make_pair
#define FI first
#define SE second
#define PB push_back
#define lid (id << 1)
#define rid (id << 1 | 1)
#define MID(a, b) ((a + b) >> 1)

const int N = 200010;
const int INF = 1000000000;
const long long Mod = 1000000007;

int sz[N], dp[N], n;
vector<int> edge[N];

void dfs1(int u, int fa, int k) {
    int K = edge[u].size();
    if(K == 1) {
        sz[u] = 1;
        dp[u] = 0;
        return;
    }
    sz[u] = 0;
    int sum = 0;
    for(int i = 0; i < K; i++) {
        int v = edge[u][i];
        if(v == fa) continue;
        dfs1(v, u, k ^ 1);
        sz[u] += sz[v];
        sum += dp[v];
    }
    if(k == 1) {
        int tot = sz[u];
        dp[u] = 0;
        for(int i = 0; i < K; i++) {
            int v = edge[u][i];
            if(v == fa) continue;
            dp[u] = max(dp[u], tot - sz[v] + dp[v]);
        }
    }
    else {
        dp[u] = sum;
    }
}

void dfs2(int u, int fa, int k) {
    int K = edge[u].size();
    if(K == 1) {
        sz[u] = 1;
        dp[u] = 0;
        return;
    }
    sz[u] = 0;
    int sum = 0;
    for(int i = 0; i < K; i++) {
        int v = edge[u][i];
        if(v == fa) continue;
        dfs2(v, u, k ^ 1);
        sz[u] += sz[v];
        sum += dp[v] + 1;
    }
    if(k == 1) {
        dp[u] = sum - 1;
    }
    else {
        dp[u] = sz[u] - 1;
        for(int i = 0; i < K; i++) {
            int v = edge[u][i];
            if(v == fa) continue;
            dp[u] = min(dp[u], dp[v]);
        }
    }
}

int main() {
    scanf("%d", &n);
    for(int i = 1; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        edge[x].push_back(y);
        edge[y].push_back(x);
    }
    dfs1(1, 0, 1);
    printf("%d ", dp[1] + 1);
    dfs2(1, 0, 1);
    printf("%d\n", dp[1] + 1);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define MAXN 200100

vector<int> G[MAXN];

int solve(int idx, int dist) {
    if(G[idx].size() == 0) return 1;
    if(dist%2 == 0) {
        int minimum = 2*MAXN;
        for(int i = 0; i<(int)G[idx].size(); i++) {
            minimum = min(minimum, solve(G[idx][i], dist+1));
        }
        return minimum;
    }
    int ret = 0;
    for(int i = 0; i<(int)G[idx].size(); i++) {
        ret += solve(G[idx][i], dist+1);
    }
    return ret;
}

int solve2(int idx, int dist) {
    if(G[idx].size() == 0) return 1;
    if(dist%2 == 0) {
        int minimum = 0;
        for(int i = 0; i<(int)G[idx].size(); i++) {
            minimum = max(minimum, solve(G[idx][i], dist+1));
        }
        return minimum;
    }
    int ret = 0;
    for(int i = 0; i<(int)G[idx].size(); i++) {
        ret += solve(G[idx][i], dist+1);
    }
    return ret;
}

int main() {
    int n;
    scanf("%d", &n);
    for(int i = 0; i<n-1; i++) {
        int u, v;
        scanf("%d %d", &u, &v);
        G[u].push_back(v);
    }
    int m = 0;
    for(int i = 1; i<=n; i++) {
        if(G[i].size() == 0) m++;
    }
    int r1 = solve(1, 0);
    int r2 = solve2(1, 0);
    printf("%d %d\n", m-r1+1, m-r2+1);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define MAXN 200100

vector<int> G[MAXN];

int solve(int idx, int dist) {
    //printf("->%d\n", idx);
    if(G[idx].size() == 0) {
        //printf("leaf %d\n", idx);
      return 1;
    }
    if(dist%2 == 0) {
        int minimum = 2*MAXN;
        for(int i = 0; i<(int)G[idx].size(); i++) {
            minimum = min(minimum, solve(G[idx][i], dist+1));
        }
        return minimum;
    }
    int ret = 0;
    for(int i = 0; i<(int)G[idx].size(); i++) {
        ret += solve(G[idx][i], dist+1);
    }
    return ret;
}

int solve2(int idx, int dist) {
    if(G[idx].size() == 0) return 1;
    if(dist%2 == 1) {
        int minimum = 2*MAXN;
        for(int i = 0; i<(int)G[idx].size(); i++) {
            minimum = min(minimum, solve2(G[idx][i], dist+1));
        }
        //printf("aa %d %d\n", idx, minimum);
        return minimum;
    }
    int ret = 0;
    for(int i = 0; i<(int)G[idx].size(); i++) {
        ret += solve2(G[idx][i], dist+1);
    }
    //printf("aa %d %d\n", idx, ret);
    return ret;
}

int main() {
    int n;
    scanf("%d", &n);
    for(int i = 0; i<n-1; i++) {
        int u, v;
        scanf("%d %d", &u, &v);
        G[u].push_back(v);
    }
    int m = 0;
    for(int i = 1; i<=n; i++) {
        if(G[i].size() == 0) m++;
    }
    int r1 = solve(1, 0);
    int r2 = solve2(1, 0);
    printf("%d %d\n", m-r1+1, r2);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define MAXN 200100

vector<int> G[MAXN];

int solve(int idx, int dist) {
    if(G[idx].size() == 0) return 1;
    if(dist%2 == 0) {
        int minimum = 2*MAXN;
        for(int i = 0; i<(int)G[idx].size(); i++) {
            minimum = min(minimum, solve(G[idx][i], dist+1));
        }
        return minimum;
    }
    int ret = 0;
    for(int i = 0; i<(int)G[idx].size(); i++) {
        ret += solve(G[idx][i], dist+1);
    }
    return ret;
}

int solve2(int idx, int dist) {
    if(G[idx].size() == 0) return 1;
    if(dist%2 == 0) {
        int minimum = 0;
        for(int i = 0; i<(int)G[idx].size(); i++) {
            minimum = max(minimum, solve2(G[idx][i], dist+1));
        }
        return minimum;
    }
    int ret = 0;
    for(int i = 0; i<(int)G[idx].size(); i++) {
        ret += solve2(G[idx][i], dist+1);
    }
    return ret;
}

int main() {
    int n;
    scanf("%d", &n);
    for(int i = 0; i<n-1; i++) {
        int u, v;
        scanf("%d %d", &u, &v);
        G[u].push_back(v);
    }
    int m = 0;
    for(int i = 1; i<=n; i++) {
        if(G[i].size() == 0) m++;
    }
    int r1 = solve(1, 0);
    int r2 = solve2(1, 0);
    printf("%d %d\n", m-r1+1, m-r2+1);
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<list>
#define NSIZ 200100
#define MSIZ 100100
#define inf 1010540580
#define mxint 2147483647
#define mxll 9223372036854775807LL
#define primell 10000000000000061LL
#define mod 1000000007
#define pii pair<int,int>
#define pli pair<long long,int>
#define F first
#define S second
#define viit vector<int>::iterator
#define vpiiit vector<pii>::iterator
#define liit list<int>::iterator
#define lpiiit list<pii>::iterator
#define ab(x) ((x)<0?-(x):(x))
using namespace std;
int n, m, o, a[NSIZ];
bool chk[NSIZ];
pii dp[NSIZ];
vector<int> ve[NSIZ];
void visit(int d, int bef, bool choose){
    if(ve[d].size()==1){dp[d]=pii(1,1);return ;}
    dp[d]=pii(0,0);
    int mx=-mxint;
    for(viit it=ve[d].begin(); it!=ve[d].end(); it++){
        if(*it==bef)continue;
        visit(*it,d,!choose);
        dp[d].S+=dp[*it].S;
        mx=max(mx,dp[*it].F-dp[*it].S);
    }
    if(choose==0)dp[d].F=dp[d].S+mx;
    else dp[d].F=dp[d].S-(ve[d].size()-1);
//    printf("%d = %d %d\n", d, dp[d]);
}
void visit2(int d, int bef, bool choose){
    if(ve[d].size()==1){dp[d]=pii(1,1);return ;}
    dp[d]=pii(0,0);
    int mx=0, mn=mxint;
    for(viit it=ve[d].begin(); it!=ve[d].end(); it++){
        if(*it==bef)continue;
        visit2(*it,d,!choose);
        dp[d].S+=dp[*it].S;
        mx+=dp[*it].F;
        mn=min(mn,dp[*it].F);
    }
    if(choose==0)dp[d].F=mx;
    else dp[d].F=mn;
//    printf("%d = %d %d\n", d, dp[d]);
}
int main(){
    int i, j, k;
    scanf("%d", &n);
    if(n==1){printf("1 1");return 0;}
    for(i=0; i<n-1; i++){
        scanf("%d %d", &j, &k);
        ve[j].push_back(k);
        ve[k].push_back(j);
    }
    visit(1,-1,0);
    printf("%d ", dp[1].F);
    visit2(1,-1,0);
    printf("%d ", dp[1].F);
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<list>
#define NSIZ 200100
#define MSIZ 100100
#define inf 1010540580
#define mxint 2147483647
#define mxll 9223372036854775807LL
#define primell 10000000000000061LL
#define mod 1000000007
#define pii pair<int,int>
#define pli pair<long long,int>
#define F first
#define S second
#define viit vector<int>::iterator
#define vpiiit vector<pii>::iterator
#define liit list<int>::iterator
#define lpiiit list<pii>::iterator
#define ab(x) ((x)<0?-(x):(x))
using namespace std;
int n, m, o, a[NSIZ];
bool chk[NSIZ];
pii dp[NSIZ];
vector<int> ve[NSIZ];
void visit(int d, int bef, bool choose){
    if(ve[d].size()==1){dp[d]=pii(1,1);return ;}
    dp[d]=pii(0,0);
    int mx=-mxint;
    for(viit it=ve[d].begin(); it!=ve[d].end(); it++){
        if(*it==bef)continue;
        visit(*it,d,!choose);
        dp[d].S+=dp[*it].S;
        mx=max(mx,dp[*it].F-dp[*it].S);
    }
    if(choose==0)dp[d].F=dp[d].S+mx;
    else dp[d].F=dp[d].S-(ve[d].size()-1)+1;
//    printf("%d = %d %d\n", d, dp[d]);
}
void visit2(int d, int bef, bool choose){
    if(ve[d].size()==1){dp[d]=pii(1,1);return ;}
    dp[d]=pii(0,0);
    int mx=0, mn=mxint;
    for(viit it=ve[d].begin(); it!=ve[d].end(); it++){
        if(*it==bef)continue;
        visit2(*it,d,!choose);
        dp[d].S+=dp[*it].S;
        mx+=dp[*it].F;
        mn=min(mn,dp[*it].F);
    }
    if(choose==0)dp[d].F=mx;
    else dp[d].F=mn;
//    printf("%d = %d %d\n", d, dp[d]);
}
int main(){
    int i, j, k;
    scanf("%d", &n);
    if(n==1){printf("1 1");return 0;}
    for(i=0; i<n-1; i++){
        scanf("%d %d", &j, &k);
        ve[j].push_back(k);
        ve[k].push_back(j);
    }
    visit(1,-1,0);
    printf("%d ", dp[1].F);
    visit2(1,-1,0);
    printf("%d ", dp[1].F);
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<list>
#define NSIZ 200100
#define MSIZ 100100
#define inf 1010540580
#define mxint 2147483647
#define mxll 9223372036854775807LL
#define primell 10000000000000061LL
#define mod 1000000007
#define pii pair<int,int>
#define pli pair<long long,int>
#define F first
#define S second
#define viit vector<int>::iterator
#define vpiiit vector<pii>::iterator
#define liit list<int>::iterator
#define lpiiit list<pii>::iterator
#define ab(x) ((x)<0?-(x):(x))
using namespace std;
int n, m, o, a[NSIZ];
bool chk[NSIZ];
pii dp[NSIZ];
vector<int> ve[NSIZ];
void visit(int d, int bef, bool choose){
    if(ve[d].size()==1 && d!=1){dp[d]=pii(1,1);return ;}
    dp[d]=pii(0,0);
    int mx=-mxint, mn=0;
    for(viit it=ve[d].begin(); it!=ve[d].end(); it++){
        if(*it==bef)continue;
        visit(*it,d,!choose);
        dp[d].S+=dp[*it].S;
        mx=max(mx,dp[*it].F-dp[*it].S);
        mn+=dp[*it].F-1;
    }
    if(choose==0)dp[d].F=dp[d].S+mx;
    else dp[d].F=mn+1;
//    printf("%d = %d %d\n", d, dp[d]);
}
void visit2(int d, int bef, bool choose){
    if(ve[d].size()==1 && d!=1){dp[d]=pii(1,1);return ;}
    dp[d]=pii(0,0);
    int mx=0, mn=mxint;
    for(viit it=ve[d].begin(); it!=ve[d].end(); it++){
        if(*it==bef)continue;
        visit2(*it,d,!choose);
        dp[d].S+=dp[*it].S;
        mx+=dp[*it].F;
        mn=min(mn,dp[*it].F);
    }
    if(choose==0)dp[d].F=mx;
    else dp[d].F=mn;
//    printf("%d = %d %d\n", d, dp[d]);
}
int main(){
    int i, j, k;
    scanf("%d", &n);
    if(n==1){printf("1 1");return 0;}
    for(i=0; i<n-1; i++){
        scanf("%d %d", &j, &k);
        ve[j].push_back(k);
        ve[k].push_back(j);
    }
    visit(1,-1,0);
    printf("%d ", dp[1].F);
    visit2(1,-1,0);
    printf("%d ", dp[1].F);
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<list>
#define NSIZ 200100
#define MSIZ 100100
#define inf 1010540580
#define mxint 2147483647
#define mxll 9223372036854775807LL
#define primell 10000000000000061LL
#define mod 1000000007
#define pii pair<int,int>
#define pli pair<long long,int>
#define F first
#define S second
#define viit vector<int>::iterator
#define vpiiit vector<pii>::iterator
#define liit list<int>::iterator
#define lpiiit list<pii>::iterator
#define ab(x) ((x)<0?-(x):(x))
using namespace std;
int n, m, o, a[NSIZ];
bool chk[NSIZ];
pii dp[NSIZ];
vector<int> ve[NSIZ];
void visit(int d, int bef, bool choose){
    if(ve[d].size()==1 && d!=1){dp[d]=pii(1,1);return ;}
    dp[d]=pii(0,0);
    int mx=-mxint, mn=0;
    for(viit it=ve[d].begin(); it!=ve[d].end(); it++){
        if(*it==bef)continue;
        visit(*it,d,!choose);
        dp[d].S+=dp[*it].S;
        mx=max(mx,dp[*it].F-dp[*it].S);
        mn+=dp[*it].F-1;
    }
    if(choose==0)dp[d].F=dp[d].S+mx;
    else dp[d].F=mn;
//    printf("%d = %d %d\n", d, dp[d]);
}
void visit2(int d, int bef, bool choose){
    if(ve[d].size()==1 && d!=1){dp[d]=pii(1,1);return ;}
    dp[d]=pii(0,0);
    int mx=0, mn=mxint;
    for(viit it=ve[d].begin(); it!=ve[d].end(); it++){
        if(*it==bef)continue;
        visit2(*it,d,!choose);
        dp[d].S+=dp[*it].S;
        mx+=dp[*it].F;
        mn=min(mn,dp[*it].F);
    }
    if(choose==0)dp[d].F=mx;
    else dp[d].F=mn;
//    printf("%d = %d %d\n", d, dp[d]);
}
int main(){
    int i, j, k;
    scanf("%d", &n);
    if(n==1){printf("1 1");return 0;}
    for(i=0; i<n-1; i++){
        scanf("%d %d", &j, &k);
        ve[j].push_back(k);
        ve[k].push_back(j);
    }
    visit(1,-1,0);
    printf("%d ", dp[1].F);
    visit2(1,-1,0);
    printf("%d ", dp[1].F);
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<list>
#define NSIZ 200100
#define MSIZ 100100
#define inf 1010540580
#define mxint 2147483647
#define mxll 9223372036854775807LL
#define primell 10000000000000061LL
#define mod 1000000007
#define pii pair<int,int>
#define pli pair<long long,int>
#define F first
#define S second
#define viit vector<int>::iterator
#define vpiiit vector<pii>::iterator
#define liit list<int>::iterator
#define lpiiit list<pii>::iterator
#define ab(x) ((x)<0?-(x):(x))
using namespace std;
int n, m, o, a[NSIZ];
bool chk[NSIZ];
pii dp[NSIZ];
vector<int> ve[NSIZ];
void visit(int d, int bef, bool choose){
    if(ve[d].size()==1){dp[d]=pii(1,1);return ;}
    dp[d]=pii(0,0);
    int mx=-mxint, mn=0;
    for(viit it=ve[d].begin(); it!=ve[d].end(); it++){
        if(*it==bef)continue;
        visit(*it,d,!choose);
        dp[d].S+=dp[*it].S;
        mx=max(mx,dp[*it].F-dp[*it].S);
        mn=max(mn,dp[*it].F);
    }
    if(choose==0)dp[d].F=dp[d].S+mx;
    else dp[d].F=mn;
//    printf("%d = %d %d\n", d, dp[d]);
}
void visit2(int d, int bef, bool choose){
    if(ve[d].size()==1){dp[d]=pii(1,1);return ;}
    dp[d]=pii(0,0);
    int mx=mxint, mn=mxint;
    for(viit it=ve[d].begin(); it!=ve[d].end(); it++){
        if(*it==bef)continue;
        visit(*it,d,!choose);
        dp[d].S+=dp[*it].S;
        mx=min(mx,dp[*it].F-dp[*it].S);
        mn=min(mn,dp[*it].F);
    }
    if(choose==0)dp[d].F=dp[d].S+mx;
    else dp[d].F=mn;
//    printf("%d = %d %d\n", d, dp[d]);
}
int main(){
    int i, j, k;
    scanf("%d", &n);
    if(n==1){printf("1 1");return 0;}
    for(i=0; i<n-1; i++){
        scanf("%d %d", &j, &k);
        ve[j].push_back(k);
        ve[k].push_back(j);
    }
    visit(1,-1,0);
    printf("%d ", dp[1].F);
    visit2(1,-1,0);
    printf("%d ", dp[1].F);
    return 0;
}


#include <bits/stdc++.h>
#define clr(A) memset(A,0,sizeof(A))

using namespace std;

typedef long long LL;
typedef pair<int,int> P;
const int mm = 200005;
const int INF = 1000000007;
int n,m,q;
int F[mm],win[mm];
vector<int> G[mm];
int a[mm],b[mm],t[mm];

int dfs(int k,int d){
    if(G[k].size()==0) {
        a[k] = b[k] = t[k] = 1;
        return 0;
    }
    a[k] =  b[k] = n;
    if(d % 2 == 0) b[k] = 0;
    else a[k] = 0;
    for(int i = 0; i < G[k].size(); i++){
        int u = G[k][i];
        dfs(u,d+1);
        t[k] += t[u];
        if(d&1){
            a[k] += a[u];

            b[k] = min(b[k],b[u]);

        }else{
            a[k] = min(a[k],a[u]);

            b[k] += b[u];
        }
    }
//    if(d&1) a[k] = a[k]*G[k].size()-G[k].size()+1;
//    else a[k] = t[k] - a[k];
    return 0;
}

int main(){

    //freopen("wcbao.in","r",stdin);

    int T, c = 0;

    while(cin >> n){
        for(int i = 1;i<=n;i++) G[i].clear();
        int u,v;
        for(int i = 1; i<n;i++){
            scanf("%d%d",&u,&v);
            G[u].push_back(v);
        }
        dfs(1,0);
        printf("%d %d\n",t[1] - a[1] + 1,b[1]);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
int main()
{
    int n;
    cin>>n;
    vector<int>adj[n+1];
   map<pair<int,int>,int>arr;
    int a,b;
    for(int i=0;i<n;++i)
    {
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
        arr.pb(mp(a,b));
    }
   int cnt=0,x,y;
   for(int i=0;i<n;++i)
   {
       for(int j=0;j<n;++j)
       {
           if(j!=i)
           {x=(arr[i].first+arr[j].first);
           y=(arr[i].second+arr[j].second);
           if(adj[x][0]==y && adj[y][0]==x)
           {
               cnt++;
           }}
       }
   }
   cout<<cnt/2<<endl;
   return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define FastRead    ios_base::sync_with_stdio(0);cin.tie(0);
#define endl        "\n"
#define pii         pair<int,int>
#define loop(i,n)   for(ll i=0; i<n; i++)
#define eloop(i,n)  for(ll i=1; i<=n; i++)
#define pb(i)       push_back(i)
#define mp(x,y)     make_pair(x,y)
#define mset(a,x)   memset(a,x,sizeof a)
#define all(x)      x.begin(),x.end()
#define ff          first
#define ss          second
#define NUM         1000005
#define sq(x)       ((x)*(x))
#define mp(x,y)     make_pair(x,y)

typedef long long ll;
typedef unsigned long long llu;

int mp[3003][3003];

int main()
{
    FastRead

    int n,ans=0;
    int x,y;
    int fx,fy;
    pii v[3003];

    cin>>n;

    for(int i=0;i<n;i++)
    {
        cin>>v[i].ff>>v[i].ss;

        mp[v[i].ff+1000][v[i].ss+1000]=1;
    }

    for(int i=0;i<n-1;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            fx = (v[i].ff+v[j].ff);
            fy = (v[i].ss+v[j].ss);

            if(fx % 2 != 0 or fy % 2 != 0)
              continue;

            fx/=2;
            fy/=2;

            if(mp[fx+1000][fy+1000]==1)
            {
                ans++;
            }
        }
    }

    cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;

#define FastRead      ios_base::sync_with_stdio(0);cin.tie(0);
#define endl          "\n"

vector< pair<int,int> > v;

int main()
{
    FastRead

    int n,x,y,ans=0;

    cin>>n;

    for(int i=0;i<n;i++)
    {
        cin>>x>>y;

        v.push_back(make_pair(x,y));
    }

    for(int i=0;i<n-2;i++)
    {
        if((((v[i].first+v[i+2].first)/2)==v[i+1].first)&&(((v[i].second+v[i+2].second)/2)==v[i+1].second))
          ans++;
    }

    cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;

#define FastRead    ios_base::sync_with_stdio(0);cin.tie(0);
#define endl        "\n"
#define pii         pair<int,int>
#define loop(i,n)   for(ll i=0; i<n; i++)
#define eloop(i,n)  for(ll i=1; i<=n; i++)
#define pb(i)       push_back(i)
#define mp(x,y)     make_pair(x,y)
#define mset(a,x)   memset(a,x,sizeof a)
#define all(x)      x.begin(),x.end()
#define ff          first
#define ss          second
#define NUM         1000005
#define sq(x)       ((x)*(x))
#define mp(x,y)     make_pair(x,y)

typedef long long ll;
typedef unsigned long long llu;

int mp[3003][3003];

int main()
{
    FastRead

    int n,ans=0;
    int x,y;
    int fx,fy;
    pii v[3003];

    cin>>n;

    for(int i=0;i<n;i++)
    {
        cin>>v[i].ff>>v[i].ss;

        mp[v[i].ff][v[i].ss]=1;
    }

    for(int i=0;i<n-1;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            fx = (v[i].ff+v[j].ff);
            fy = (v[i].ss+v[j].ss);

            if(fx % 2 != 0 or fy % 2 != 0)
              continue;

            fx/=2;
            fy/=2;

            if(mp[fx][fy]==1)
            {
                ans++;
            }
        }
    }

    cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;

#define FastRead    ios_base::sync_with_stdio(0);cin.tie(0);
#define endl        "\n"
#define pii         pair<double,double>
#define loop(i,n)   for(ll i=0; i<n; i++)
#define eloop(i,n)  for(ll i=1; i<=n; i++)
#define pb(i)       push_back(i)
#define mp(x,y)     make_pair(x,y)
#define mset(a,x)   memset(a,x,sizeof a)
#define all(x)      x.begin(),x.end()
#define ff          first
#define ss          second
#define NUM         1000005
#define sq(x)       ((x)*(x))
#define mp(x,y)     make_pair(x,y)

typedef long long ll;
typedef unsigned long long llu;

map <pii,int> mp;

int main()
{
    FastRead

    int n,ans=0;
    double x,y;
    double fx,fy;
    vector<pii>v;

    cin>>n;

    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        v.push_back(make_pair(x,y));
        mp[{x,y}]++;
    }

    for(int i=0;i<n-1;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            fx = ((double)v[i].ff+(double)v[j].ff)/2.0;
            fy = ((double)v[i].ss+(double)v[j].ss)/2.0;

            //cout<<fx<<" "<<fy<<endl;

            if(mp[{fx,fy}]>=1)
            {
                ans++;
            }
        }
    }

    cout<<ans;
}


#include<iostream>
using namespace std;
#include<math.h>
#include<map>
#include<vector>
#include<algorithm>
#define ll long long
#define ld double
#include<stdio.h>
#include<unordered_map>
//#include <boost/functional/hash.hpp>
int main()
{
	int t;
	cin>>t;
	//unordered_map<pair<int,int>, bool, boost::hash<pair<int, int>>> mp;
    unordered_map< int,unordered_map<int,bool> > mp;
	vector< pair<int,int> >vec;
	while(t--)
	{
		int x,y;
		cin>>x>>y;
		//unordered_map<int,int> fo;
	    pair<int,int> fo;
		fo=make_pair(x,y);
	    mp[x][y]=true;
		//mp.insert(make_pair(make_pair(x,y), true));
		vec.push_back(fo);
	}
	int c=0;
	for(int i=0;i<vec.size()-1;i++)
	{
		for(int j=i+1;j<vec.size();j++)
		{
			int f1=vec[i].first+vec[j].first;
			int s1=vec[i].second+vec[j].second;
			if(f1%2==0&&s1%2==0)
			{
			if(mp[f1/2][s1/2]==true)
			c++;
			}
		}
	}
	cout<<c<<endl;
	return 0;
}


#include<iostream>
using namespace std;
#include<math.h>
#include<map>
#include<vector>
#include<algorithm>
#define ll long long
#define ld double
#include<stdio.h>
#include<unordered_map>
#include <boost/functional/hash.hpp>
int main()
{
	int t;
	cin>>t;
	unordered_map<pair<int,int>, bool, boost::hash<pair<int, int>>> mp;
   // unordered_map<pair<int,int>,int> mp;
	vector< pair<int,int> >vec;
	while(t--)
	{
		int x,y;
		cin>>x>>y;
		pair<int,int> fo;
		fo=make_pair(x,y);
	    mp[fo]=true;
		//mp.insert(make_pair(make_pair(x,y), true));
		vec.push_back(fo);
	}
	int c=0;
	for(int i=0;i<vec.size();i++)
	{
		for(int j=i+1;j<vec.size();j++)
		{
			float f1=float(vec[i].first+vec[j].first)/2.0;
			float s1=float(vec[i].second+vec[j].second)/2.0;
			if(ceil(f1)==floor(f1)&&ceil(s1)==floor(s1))
			{
			if(mp.find(make_pair((int)f1,(int)s1))!=mp.end())
			c++;
			}
		}
	}
	cout<<c<<endl;
	return 0;
}


#include<iostream>
using namespace std;
#include<math.h>
#include<map>
#include<vector>
#include<algorithm>
#define ll long long
#define ld double
#include<stdio.h>
#include<unordered_map>
//#include <boost/functional/hash.hpp>
int main()
{
	int t;
	cin>>t;
	//unordered_map<pair<int,int>, bool, boost::hash<pair<int, int>>> mp;
    unordered_map< int,unordered_map<int,bool> > mp;
	vector< pair<int,int> >vec;
	while(t--)
	{
		int x,y;
		cin>>x>>y;
		//unordered_map<int,int> fo;
	    pair<int,int> fo;
		fo=make_pair(x,y);
	    mp[x][y]=true;
		//mp.insert(make_pair(make_pair(x,y), true));
		vec.push_back(fo);
	}
	int c=0;
	for(int i=0;i<vec.size();i++)
	{
		for(int j=i+1;j<vec.size();j++)
		{
			float f1=float(vec[i].first+vec[j].first)/2.0;
			float s1=float(vec[i].second+vec[j].second)/2.0;
			if(ceil(f1)==floor(f1)&&ceil(s1)==floor(s1))
			{
			if(mp[(int)f1][(int)s1]==true)
			c++;
			}
		}
	}
	cout<<c<<endl;
	return 0;
}


#include<iostream>
using namespace std;
#include<math.h>
#include<map>
#include<vector>
#include<algorithm>
#define ll long long
#define ld double
#include<stdio.h>
#include <unordered_map>
#include<conio.h>
int main()
{
	int t;
	cin>>t;
	unordered_map<pair<int,int>,bool> mp;
	vector< pair<int,int> >vec;
	while(t--)
	{
		int x,y;
		cin>>x>>y;
		pair<int,int> fo;
		fo=make_pair(x,y);
		mp[fo]=true;
		vec.push_back(fo);
	}
	int c=0;
	for(int i=0;i<vec.size();i++)
	{
		for(int j=i+1;j<vec.size();j++)
		{
			float f1=float(vec[i].first+vec[j].first)/2.0;
			float s1=float(vec[i].second+vec[j].second)/2.0;
			if(ceil(f1)==floor(f1)&&ceil(s1)==floor(s1))
			{
			pair<int,int> mo;
			mo=make_pair((int)f1,(int)s1);
			if(mp[mo]==true)
			c++;
			}
		}
	}
	cout<<c<<endl;
	return 0;
}


#include<iostream>
using namespace std;
#include<math.h>
#include<map>
#include<vector>
#include<algorithm>
#define ll long long
#define ld double
#include<stdio.h>

#include<conio.h>
int main()
{
	int t;
	cin>>t;
	map<pair<int,int>,bool> mp;
	vector< pair<int,int> >vec;
	while(t--)
	{
		int x,y;
		cin>>x>>y;
		pair<int,int> fo;
		fo=make_pair(x,y);
		mp[fo]=true;
		vec.push_back(fo);
	}
	int c=0;
	for(int i=0;i<vec.size();i++)
	{
		for(int j=i+1;j<vec.size();j++)
		{
			float f1=float(vec[i].first+vec[j].first)/2.0;
			float s1=float(vec[i].second+vec[j].second)/2.0;
			if(ceil(f1)==floor(f1)&&ceil(s1)==floor(s1))
			{
			pair<int,int> mo;
			mo=make_pair((int)f1,(int)s1);
			if(mp[mo]==true)
			c++;
			}
		}
	}
	cout<<c<<endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <utility>
#include <set>
#include <queue>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <climits>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef map<int, int>  mii;
typedef vector<int> vec;
typedef vector<vec> mat;
typedef vector<string> ves;
#define rep(i, n) for(int i=0; i<n; i++)
#define re0(i, n) for(int i=0; i<=n; i++)
#define re1(i, k, n) for(int i=k; i<n; i++)
#define re2(i, k, n) for(int i=k; i<=n; i++)
#define re3(i, n) for(int i=n-1; i>=0; i--)
#define typeof(X) std::identity<decltype(X)>::type
#define rec(container, it) for(typeof(container.begin()) it=container.begin(); it!=container.end(); it++)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
#define all(v) v.begin(), v.end()
#define pb push_back

ll gcd(ll a, ll b) { return b == 0L ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
string i2s(int i) { stringstream ss; ss << i; return ss.str(); }
int s2i(string s) { stringstream ss; ss << s; int res; ss >> res; return res; }
const int INF = 987654321;
const double EPS = 1e-9;

int a[2010][2010];
int x[3010], y[3010];

class Main {
public:
    void solve() {
        int n; cin >> n;
        memset(a, 0, sizeof(a));
        rep(i, n) {
            cin >> x[i] >> y[i];
            x[i] += 1000;
            y[i] += 1000;
            a[x[i]][y[i]]++;
        }
        int res = 0;
        rep(i, n) {
            re1(j, i+1, n) {
                if( (x[i]+x[j])%2==0 && (y[i]+y[j])%2==0 ) {
                    int X = (x[i]+x[j]) / 2;
                    int Y = (y[i]+y[j]) / 2;
                    if(a[X][Y] == 1) { res++; }
                }
            }
        }
        cout << res << endl;
    }
};

int main(void) {
    Main _main;
    _main.solve();
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <utility>
#include <set>
#include <queue>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <climits>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef map<int, int>  mii;
typedef vector<int> vec;
typedef vector<vec> mat;
typedef vector<string> ves;
#define rep(i, n) for(int i=0; i<n; i++)
#define re0(i, n) for(int i=0; i<=n; i++)
#define re1(i, k, n) for(int i=k; i<n; i++)
#define re2(i, k, n) for(int i=k; i<=n; i++)
#define re3(i, n) for(int i=n-1; i>=0; i--)
#define typeof(X) std::identity<decltype(X)>::type
#define rec(container, it) for(typeof(container.begin()) it=container.begin(); it!=container.end(); it++)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
#define all(v) v.begin(), v.end()
#define pb push_back

ll gcd(ll a, ll b) { return b == 0L ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
string i2s(int i) { stringstream ss; ss << i; return ss.str(); }
int s2i(string s) { stringstream ss; ss << s; int res; ss >> res; return res; }
const int INF = 987654321;
const double EPS = 1e-9;

class Main {
public:
    void solve() {
        int n; cin >> n;
        vector<pii> xy;
        rep(i, n) {
            int x; cin >> x;
            int y; cin >> y;
            xy.pb( make_pair(x, y) );
        }
        sort(all(xy));
        int sz = xy.size();
        int res = 0;
        rep(i, sz-1) {
            re1(a, 1, sz) {
                if(i + a*2 >= sz) { continue; }
                if(xy[i].first  + xy[i+a*2].first  == 2*xy[i+a].first &&
                   xy[i].second + xy[i+a*2].second == 2*xy[i+a].second) {
                    res++;
                  }
            }
        }
        cout << res << endl;
    }
};

int main(void) {
    Main _main;
    _main.solve();
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <utility>
#include <set>
#include <queue>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <climits>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef map<int, int>  mii;
typedef vector<int> vec;
typedef vector<vec> mat;
typedef vector<string> ves;
#define rep(i, n) for(int i=0; i<n; i++)
#define re0(i, n) for(int i=0; i<=n; i++)
#define re1(i, k, n) for(int i=k; i<n; i++)
#define re2(i, k, n) for(int i=k; i<=n; i++)
#define re3(i, n) for(int i=n-1; i>=0; i--)
#define typeof(X) std::identity<decltype(X)>::type
#define rec(container, it) for(typeof(container.begin()) it=container.begin(); it!=container.end(); it++)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
#define all(v) v.begin(), v.end()
#define pb push_back

ll gcd(ll a, ll b) { return b == 0L ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
string i2s(int i) { stringstream ss; ss << i; return ss.str(); }
int s2i(string s) { stringstream ss; ss << s; int res; ss >> res; return res; }
const int INF = 987654321;
const double EPS = 1e-9;

class Main {
public:
    void solve() {
        int n; cin >> n;
        vector<pii> xy;
        rep(i, n) {
            int x; cin >> x;
            int y; cin >> y;
            xy.pb( make_pair(x, y) );
        }
        sort(all(xy));
        int sz = xy.size();
        int res = 0;
        rep(i, sz-1) {
            re1(a, 1, sz) {
                if(i + a >= sz) { continue; }
                re1(b, a+1, sz) {
                    if(i + b >= sz) { continue; }
                    if(xy[i].first  + xy[i+b].first  == 2*xy[i+a].first &&
                       xy[i].second + xy[i+b].second == 2*xy[i+a].second) {
                        res++;
                    }
                }
            }
        }
        cout << res << endl;
    }
};

int main(void) {
    Main _main;
    _main.solve();
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

void main(int argc, char *argv[]){
    int n;
    int res = 0;
    cin >> n;
    VI x(n), y(n);
    REP(i, n)cin >> x[i] >> y[i];
    REP(i, n){
        FOR(j, i+1, n){
            REP(k, n){
                if(k==j || k==i)continue;
                if(((x[i] < x[k]) && (x[k] < x[j])) || ((x[i] > x[k]) && (x[k] > x[j])) && ((x[k]-x[i])*(y[j]-y[i])==(x[j]-x[i])*(y[k]-y[i]))){
                    res++;
                }
            }
        }
    }
    printf("%d\n", res);
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

void main(int argc, char *argv[]){
    int n;
    int res = 0;
    cin >> n;
    set<PII> l;
    vector<PII> L;
    REP(i, n){
        int tx, ty;
        cin >> tx>> ty;
        l.insert(MP(tx, ty));
        L.PB(MP(tx, ty));
    }
    REP(i, n){
        FOR(j, i+1, n){
            int X = L[i].first + L[j].first;
            int Y = L[i].second+L[j].second;
            if(X&1 || Y&1)continue;
            if(l.end() != l.find(MP(X/2, Y/2)))res++;
        }
    }
    printf("%d\n", res);
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

void main(int argc, char *argv[]){
    int n;
    int res = 0;
    cin >> n;
    VI x(n), y(n);
    REP(i, n)cin >> x[i] >> y[i];
    REP(i, n){
        FOR(j, i+1, n){
            REP(k, n){
                if(k==j || k==i)continue;
                if( ((x[k]-x[i])*(x[k]-x[j])<0) && ((x[k]-x[i])*(y[j]-y[i])==(x[j]-x[i])*(y[k]-y[i]))){
                    res++;
                }
            }
        }
    }
    printf("%d\n", res);
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

void main(int argc, char *argv[]){
    int n;
    int res = 0;
    cin >> n;
    VI x(n), y(n);
    REP(i, n)cin >> x[i] >> y[i];
    REP(i, n){
        FOR(j, i+1, n){
            REP(k, n){
                if(k==j || k==i)continue;
                if((x[i] < x[k]) && (x[k] < x[j]) && ((x[k]-x[i])*(y[j]-y[i])==(x[j]-x[i])*(y[k]-y[i]))){
                    res++;
                }
            }
        }
    }
    printf("%d\n", res);
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <utility>
#include <deque>
#include <list>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <cmath>

using namespace std;

#define forn(i,n) for (int i=0; i<int(n); ++i)
#define forl(i,n) for (int i=int(n)-1; i>=0; --i)
#define forab(i,a,b) for (int i=int(a); i<=int(b); ++i)
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define ll long long
#define pii pair <int,int>
#define sz(a) a.size()
#define np next_permutation

const int INF = (int)1e9;
const long long INF64 = (long long) 1e18;
const long double eps = 1e-9;
const long double pi = 3.14159265358979323846;
bool ineedoutputfile = false;
int d[2001][2001];
int main () {
#ifndef ONLINE_JUDGE
	//freopen("input.txt","rt",stdin);
	if (ineedoutputfile)
		freopen("output.txt","wt",stdout);
#endif
	int n;
	cin >> n;
	vector < pii > v(n);
	set <pii> s;
	forn(i,n) {
		cin >> v[i].first >> v[i].second;
		v[i].first+=1000, v[i].second+=1000;
		d[v[i].first][v[i].second]=1;
	}
	int ans = 0;
	forn(i,n)
		forab(j,i+1,n-1) {
			if ((v[i].first+v[j].first)%2!=0)
				continue;
			if ((v[i].second+v[j].second)%2!=0)
				continue;
			if (d[(v[i].first+v[j].first)/2][(v[i].second+v[j].second)/2])
				ans++;
	}
	cout<<ans<<endl;
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cmath>
#include <time.h>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <assert.h>
#include <cstdio>
#include <deque>

using namespace std;

typedef long long ll;
typedef double db;
typedef string str;

#define INF 1e+9
#define EPS 1e-3
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define pii pair<int,int>
#define pll pair<ll, ll>
#define pdd pair<db,db>
#define X first
#define Y second
#define sz(a) ( (int) a.size() )
#define len(a) ( (int) a.length() )
#define ALL(a) a.begin(),a.end()
#define pll pair<int, int>
#define pib pair<int, bool>

#ifdef _DEBUG
	const int maxn = (int) 2e+5;
#else
	const int maxn = (int) 2e+5 + 2000;
#endif

long long ABS(long long a){
	return a > 0 ? a : -a;
}

int gcd(int a, int b){
	if (a < b) swap(a, b);
	while(b){
		int buffer = b;
		b = a % b;
		a = buffer;
	}
	return a;
}

int n;

set<pii> point;
vector<pii> points;

int main(){
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
#endif
	scanf("%d", &n);
	for (int i=0; i<n; i++){
		pii p;
		scanf("%d%d", &p.X, &p.Y);
		point.insert(p);
		points.pb(p);
	}
	int count = 0;
	for (int i=0; i<sz(points); i++)
		for (int j=i+1; j<sz(points); j++){
			pii middle;
			middle.X = (points[i].X + points[j].X) >> 1;
			middle.Y = (points[i].Y + points[j].Y) >> 1;
			if ((points[i].X + points[j].X) & 1) continue;
			if ((points[i].Y + points[j].Y) & 1) continue;
			if (point.find(middle) != point.end()) count++;
		}
	printf("%d", count);
	return 0;
}


#include<iostream>
#include<stdio.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
bool exist[4004005];
int n;
int x[3005],y[3005];

int main()
{
    while(scanf("%d",&n)!=EOF)
    {
        memset(exist,0,sizeof(exist));
        for(int i=0;i<n;i++)
        {
            scanf("%d%d",&x[i],&y[i]);
            x[i]+=1000;y[i]+=1000;
            exist[x[i]*2001+y[i]]=true;
        }
        int ans=0;
        for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)if(i!=j)
        {
            int nx=x[j]+x[i],ny=y[j]+y[i];
            if(nx%2==1||ny%2==1)continue;
            nx/=2;ny/=2;
            if(exist[nx*2001+ny])ans++;
            //if(nx==x[i]&&ny==y[i]|| nx==x[j]&&ny==y[j])continue;
            //if(nx>=0&&ny>=0&&exist[nx*2001+ny])ans++;
        }
        printf("%d\n",ans/2);
    }
    return 0;
}


/*
author:Binoy
college:Kalyani Govt. Engineering College
class:Computer Science
codeforces handle:bit-2
*/
#include<algorithm>
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<ctype.h>
#include<utility>
#include<conio.h>
#include<vector>
#include<string>
#include<math.h>
#include<set>
#include<map>
using namespace std;
int dp[3000][3000];
int main()
{
	int n,res=0,x,y;
	pair<int,int> a[3001];
	cin>>n;
	for (int i = 0; i < n; i++)
	{
		cin>>x>>y;
		a[i].first=x+1001;a[i].second=y+1001;
		dp[a[i].first][a[i].second]=1;
	}
	for (int i = 0; i < n-1; i++)
		for(int j=i+1;j<n;j++)
			if((a[i].first+a[j].first)%2==0 && (a[i].second+a[j].second)%2==0)
				if(dp[(a[i].first+a[j].first)/2][(a[i].second+a[j].second)/2])
					res++;
	cout<<res;
	//getch();
	return 0;
}


#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <time.h>
using namespace std;
#define ll long long int
const int mod=1e9+7, malo=-1e18;

struct point{
    double x;
    double y;
};
point cp(double x, double y){
    point p;
    p.x=x;
    p.y=y;
    return p;
}
point getp(){
    point p;
    double x1, y1;
    scanf("%lf%lf",&x1,&y1);
    p.x=x1;
    p.y=y1;
    return p;
}
bool operator<(point p1, point p2){
    if(p1.x<p2.x) return true;
    if(p1.x==p2.x&&p1.y<p2.y) return true;
    return false;
}
bool operator>(point p1, point p2){
    if(p1.x>p2.x) return true;
    if(p1.x==p2.x&&p1.y>p2.y) return true;
    return false;
}
bool operator==(point p1, point p2){
    if(p1.x==p2.x&&p1.y==p2.y) return true;
    else return false;
}

int main(){
#pragma comment(linker, "/STACK:268435456")
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
#endif
//#ifdef ONLINE_JUDGE
//  freopen("lca_rmq.in", "rt", stdin);
//  freopen("lca_rmq.out", "wt", stdout);
//#endif
    point p[3333], s;
    int i, n, j, l, r, m, ans;
    scanf("%d",&n);
    for(i=0;i<n;i++) p[i]=getp();
    sort(p,p+n);
    ans=0;
    for(i=0;i<n;i++){
        for(j=i+2;j<n;j++){
            l=i+1;
            r=j-1;
            s.x=(p[i].x+p[j].x)/2;
            s.y=(p[i].y+p[j].y)/2;
            while(r-l>1){
                m=(l+r)/2;
                if(p[m]<s) l=m;
                else r=m;
            }
            if(p[r]==s) ans++;
        }
    }
    printf("%d",ans);

    return 0;
}


#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <time.h>
using namespace std;
#define ll long long int
const int mod=1e9+7, malo=-1e18;

struct point{
    double x;
    double y;
};
point cp(double x, double y){
    point p;
    p.x=x;
    p.y=y;
    return p;
}
point getp(){
    point p;
    double x1, y1;
    scanf("%lf%lf",&x1,&y1);
    p.x=x1;
    p.y=y1;
    return p;
}
bool operator<(point p1, point p2){
    if(p1.x<p2.x) return true;
    if(p1.x==p2.x&&p1.y<p2.y) return true;
    return false;
}
bool operator>(point p1, point p2){
    if(p1.x>p2.x) return true;
    if(p1.x==p2.x&&p1.y>p2.y) return true;
    return false;
}
bool operator==(point p1, point p2){
    if(p1.x==p2.x&&p1.y==p2.y) return true;
    else return false;
}

int main(){
#pragma comment(linker, "/STACK:268435456")
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
#endif
//#ifdef ONLINE_JUDGE
//  freopen("lca_rmq.in", "rt", stdin);
//  freopen("lca_rmq.out", "wt", stdout);
//#endif
    point p[1111], s;
    int i, n, j, l, r, m, ans;
    scanf("%d",&n);
    for(i=0;i<n;i++) p[i]=getp();
    sort(p,p+n);
    ans=0;
    for(i=0;i<n;i++){
        for(j=i+2;j<n;j++){
            l=i+1;
            r=j-1;
            s.x=(p[i].x+p[j].x)/2;
            s.y=(p[i].y+p[j].y)/2;
            while(r-l>1){
                m=(l+r)/2;
                if(p[m]<s) l=m;
                else r=m;
            }
            if(p[r]==s) ans++;
        }
    }
    printf("%d",ans);

    return 0;
}


#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <time.h>
using namespace std;
#define ll long long int
const int mod=1e9+7, malo=-1e18;

struct point{
    double x;
    double y;
};
point cp(double x, double y){
    point p;
    p.x=x;
    p.y=y;
    return p;
}
point getp(){
    point p;
    double x1, y1;
    scanf("%lf%lf",&x1,&y1);
    p.x=x1;
    p.y=y1;
    return p;
}
bool operator<(point p1, point p2){
    if(p1.x<p2.x) return true;
    if(p1.x==p2.x&&p1.y<p2.y) return true;
    return false;
}
bool operator>(point p1, point p2){
    if(p1.x>p2.x) return true;
    if(p1.x==p2.x&&p1.y>p2.y) return true;
    return false;
}
bool operator==(point p1, point p2){
    if(p1.x==p2.x&&p1.y==p2.y) return true;
    else return false;
}

int main(){
#pragma comment(linker, "/STACK:268435456")
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
#endif
//#ifdef ONLINE_JUDGE
//  freopen("lca_rmq.in", "rt", stdin);
//  freopen("lca_rmq.out", "wt", stdout);
//#endif
    point p[3333], s;
    int i, n, j, l, r, m, ans;
    scanf("%d",&n);
    for(i=0;i<n;i++) p[i]=getp();
    sort(p,p+n);
    ans=0;
    for(i=0;i<n;i++){
        for(j=i+2;j<n;j++){
            l=i;
            r=j-1;
            s.x=(p[i].x+p[j].x)/2;
            s.y=(p[i].y+p[j].y)/2;
            while(r-l>1){
                m=(l+r)/2;
                if(p[m]<s) l=m;
                else r=m;
            }
            if(p[r]==s) ans++;
        }
    }
    printf("%d",ans);

    return 0;
}


#pragma comment(linker, "/stack:64000000")

#include <cstdio>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <ctime>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <queue>

using namespace std;

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

typedef long long llong;

int main() {
#ifdef LOCAL
	freopen("test.in", "r", stdin);
	freopen("test.out", "w", stdout);
#endif
	int n;
	cin >> n;
	vector <int> x(n), y(n);
	REP(i, n) cin >> x[i] >> y[i];
	set <pair <int, int> > s;
	REP(i, n) s.insert(make_pair(x[i], y[i]));
	int res = 0;
	REP(i, n) REP(j, i) {
		if ((x[i] + x[j]) % 2 == 0 && (y[i] + y[j]) % 2 == 0 && s.count(make_pair((x[i] + x[j]) / 2, (y[i] + y[j]) / 2))) ++res;
	}
	cout << res;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

bool mark[2000 + 10][2000 + 10];
vector <pair<int , int> > v;

int main()
{
	memset(mark , false , sizeof mark);
	int n , ans = 0;
	cin>>n;
	for(int i = 0 ; i < n ; i++)
	{
		int x , y;
		cin>>x>>y;
		mark[x + 1000][y + 1000] = true;
		v.push_back(make_pair(x + 1000 , y + 1000));
	}
	for(int i = 0 ; i < n ; i++)
		for(int j = 0 ; j < n ; j++)
		{
			if(j == i)
				continue;
			int x1 = v[i].first , x2 = v[j].first , y1 = v[i].second , y2 = v[j].second;
			if(2 * x2 - x1 <= 2000 && 2 * y2 - y1 <= 2000 && mark[2 * x2 - x1][2 * y2 - y1])
				ans++;
		}
	cout<<ans / 2<<endl;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

bool mark[2000 + 10][2000 + 10];
vector <pair<int , int> > #include <iostream>
#include <vector>

using namespace std;

bool mark[2000 + 10][2000 + 10];
vector <pair<int , int> > v;

int main()
{
    memset(mark , false , sizeof mark);
    int n , ans = 0;
    cin>>n;
    for(int i = 0 ; i < n ; i++)
    {
        int x , y;
        cin>>x>>y;
        mark[x + 1000][y + 1000] = true;
        v.push_back(make_pair(x + 1000 , y + 1000));
    }
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < n ; j++)
        {
            if(j == i)
                continue;
            int x1 = v[i].first , x2 = v[j].first , y1 = v[i].second , y2 = v[j].second;
            if(2 * x2 - x1 >= 0 && 2 * x2 - x1 <= 2000 && 2 * y2 - y1 <= 2000 && 2 * y2 - y1 >= 0 && mark[2 * x2 - x1][2 * y2 - y1])
                ans++;
        }
    cout<<ans / 2<<endl;
    return 0;
}v;

int main()
{
    memset(mark , false , sizeof mark);
    int n , ans = 0;
    cin>>n;
    for(int i = 0 ; i < n ; i++)
    {
        int x , y;
        cin>>x>>y;
        mark[x + 1000][y + 1000] = true;
        v.push_back(make_pair(x + 1000 , y + 1000));
    }
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < n ; j++)
        {
            if(j == i)
                continue;
            int x1 = v[i].first , x2 = v[j].first , y1 = v[i].second , y2 = v[j].second;
            if(2 * x2 - x1 <= 2000 && 2 * y2 - y1 <= 2000 && mark[2 * x2 - x1][2 * y2 - y1])
                ans++;
        }
    cout<<ans / 2<<endl;
    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

bool mark[2000 + 10][2000 + 10];
vector <pair<int , int> > v;

int main()
{
	memset(mark , false , sizeof mark);
	int n , ans = 0;
	cin>>n;
	for(int i = 0 ; i < n ; i++)
	{
		int x , y;
		cin>>x>>y;
		mark[x + 1000][y + 1000] = true;
		v.push_back(make_pair(x + 1000 , y + 1000));
	}
	for(int i = 0 ; i < n ; i++)
		for(int j = 0 ; j < n ; j++)
		{
			if(j == i)
				continue;
			int x1 = min(v[i].first , v[j].first) , x2 = max(v[i].first , v[j].first) , y1 = min(v[i].second , v[j].second) , y2 = max(v[i].second , v[j].second);
			if(2 * x2 - x1 <= 2000 && 2 * y2 - y1 <= 2000 && mark[2 * x2 - x1][2 * y2 - y1])
				ans++;
		}
	cout<<ans / 2<<endl;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

bool mark[2000 + 10][2000 + 10];
vector <pair<int , int> > v;

int main()
{
    int n , ans = 0;
    cin>>n;
    for(int i = 0 ; i < n ; i++)
    {
        int x , y;
        cin>>x>>y;
        mark[x + 1000][y + 1000] = true;
        v.push_back(make_pair(x + 1000 , y + 1000));
    }
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < n ; j++)
        {
            if(j == i)
                continue;
            int x1 = min(v[i].first , v[j].first) , x2 = max(v[i].first , v[j].first) , y1 = min(v[i].second , v[j].second) , y2 = max(v[i].second , v[j].second);
            if(mark[2 * x2 - x1][2 * y2 - y1])
                ans++;
        }
    cout<<ans / 2<<endl;
    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

bool mark[2000 + 10][2000 + 10];
vector <pair<int , int> > v;

int main()
{
    memset(mark , false , sizeof mark);
    int n , ans = 0;
    cin>>n;
    for(int i = 0 ; i < n ; i++)
    {
        int x , y;
        cin>>x>>y;
        mark[x + 1000][y + 1000] = true;
        v.push_back(make_pair(x + 1000 , y + 1000));
    }
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < n ; j++)
        {
            if(j == i)
                continue;
            int x1 = v[i].first , x2 = v[j].first , y1 = v[i].second , y2 = v[j].second;
            if(2 * x2 - x1 >= 0 && 2 * x2 - x1 <= 2000 && 2 * y2 - y1 <= 2000 && 2 * y2 - y1 >= 0 && mark[2 * x2 - x1][2 * y2 - y1])
                ans++;
        }
    cout<<ans / 2<<endl;
    return 0;
}


#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT","r",stdin);
	//freopen("OUTPUT.TXT","w",stdout);
	#endif
	int n;
	cin>>n;
	vector<pair<int,int> > mas(n);
	for(int i=0; i<n; i++)
	{
		cin>>mas[i].first>>mas[i].second;
	}
	int S=0;
	sort(mas.begin(),mas.end());
	for(int i=0; i<n-1; i++)
	{
		for(int j=i+1; j<n; j++)
		{
			for(int k=i+1; k<j; k++)
			{
				if((mas[i].first+mas[j].first)%2==0 && (mas[i].second+mas[j].second)%2==0 && (mas[i].first+mas[j].first)/2==mas[k].first && (mas[i].second+mas[j].second)/2==mas[k].second )
				{
					S++;
					break;
				}
			}
		}
	}
	cout<<S;
	return 0;

}


#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT","r",stdin);
	//freopen("OUTPUT.TXT","w",stdout);
	#endif
	int n;
	cin>>n;
	vector<pair<int,int> > mas(n);
	for(int i=0; i<n; i++)
	{
		cin>>mas[i].first>>mas[i].second;
	}
	long long S=0;
	sort(mas.begin(),mas.end());
	vector<pair<int,int> > buf;
	for(int i=0; i<n-1; i++)
	{
		for(int j=i+1; j<n; j++)
		{
			if((mas[i].first+mas[j].first)%2==0 && (mas[i].second+mas[j].second)%2==0)
			{
				buf.push_back(mp<int,int> ((mas[i].first+mas[j].first)/2,(mas[i].second+mas[j].second)/2));
			}
		}
	}
	for(int i=0; i<n; i++)
	{
		for(int j=0; j<buf.size(); j++)
		{
			if(mas[i].first==mas[j].first && mas[i].second==mas[j].second)
			{
				S++;

			}
		}
	}

	cout<<S;
	return 0;

}


#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT","r",stdin);
	//freopen("OUTPUT.TXT","w",stdout);
	#endif
	int n;
	cin>>n;
	vector<pair<int,int> > mas(n);
	for(int i=0; i<n; i++)
	{
		cin>>mas[i].first>>mas[i].second;
	}
	int S=0;
	sort(mas.begin(),mas.end());
	for(int i=0; i<n-1; i++)
	{
		for(int j=i+1; j<n; j++)
		{
			for(int k=0; k<n; k++)
			{
				if(k!=i && k!=j && mas[i].first<=mas[k].first && mas[j].first>=mas[k].first)
				{
					if(mas[i].first+mas[k].first==mas[j].first && mas[i].second+mas[k].second==mas[j].second)
					{
						S++;
					}
				}
			}
		}
	}
	cout<<S;
	return 0;

}


#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT","r",stdin);
	//freopen("OUTPUT.TXT","w",stdout);
	#endif
	int n;
	cin>>n;
	vector<pair<int,int> > mas(n);
	for(int i=0; i<n; i++)
	{
		cin>>mas[i].first>>mas[i].second;
	}
	int S=0;
	sort(mas.begin(),mas.end());
	for(int i=0; i<n-1; i++)
	{
		for(int j=i+1; j<n; j++)
		{
			for(int k=0; k<n; k++)
			{
				if(k!=i && k!=j && mas[i].first<=mas[k].first && mas[j].first>=mas[k].first)
				{
					if((mas[i].first+mas[j].first)%2==0 && (mas[i].second+mas[j].second)%2==0 && (mas[i].first+mas[j].first)/2==mas[k].first && (mas[i].second+mas[j].second)/2==mas[k].second )
					{
						S++;
					}
				}
			}
		}
	}
	cout<<S;
	return 0;

}


#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT","r",stdin);
	//freopen("OUTPUT.TXT","w",stdout);
	#endif
	int n;
	cin>>n;
	vector<pair<int,int> > mas(n);
	for(int i=0; i<n; i++)
	{
		cin>>mas[i].first>>mas[i].second;
	}
	long long S=0;
	sort(mas.begin(),mas.end());
	vector<pair<int,int> > buf;
	for(int i=0; i<n-1; i++)
	{
		for(int j=i+1; j<n; j++)
		{
			if((mas[i].first+mas[j].first)%2==0 && (mas[i].second+mas[j].second)%2==0)
			{
				buf.push_back(mp<int,int> ((mas[i].first+mas[j].first)/2,(mas[i].second+mas[j].second)/2));
			}
		}
	}
	for(int i=0; i<n; i++)
	{
		for(int j=0; j<buf.size(); j++)
		{
			if(mas[i].first==mas[j].first && mas[i].second==mas[j].second)
			{
				S++;
				break;
			}
		}
	}

	cout<<S;
	return 0;

}


#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT","r",stdin);
	//freopen("OUTPUT.TXT","w",stdout);
	#endif
	int n;
	cin>>n;
	vector<pair<int,int> > mas(n);
	for(int i=0; i<n; i++)
	{
		cin>>mas[i].first>>mas[i].second;
	}
	int S=0;
	sort(mas.begin(),mas.end());
	for(int i=0; i<n-1; i++)
	{
		for(int j=i+1; j<n; j++)
		{
			for(int k=0; k<n; k++)
			{
				if(mas[k].first>mas[j].first)
				{
					break;
				}
				if(k!=i && k!=j && mas[i].first<=mas[k].first && mas[j].first>=mas[k].first)
				{
					if((mas[i].first+mas[j].first)%2==0 && (mas[i].second+mas[j].second)%2==0 && (mas[i].first+mas[j].first)/2==mas[k].first && (mas[i].second+mas[j].second)/2==mas[k].second )
					{
						S++;
						break;
					}
				}
			}
		}
	}
	cout<<S;
	return 0;

}


#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT","r",stdin);
	//freopen("OUTPUT.TXT","w",stdout);
	#endif
	int n;
	cin>>n;
	vector<pair<int,int> > mas(n);
	for(int i=0; i<n; i++)
	{
		cin>>mas[i].first>>mas[i].second;
	}
	int S=0;
	sort(mas.begin(),mas.end());
	vector<pair<int,int> > buf;
	for(int i=0; i<n-1; i++)
	{
		for(int j=i+1; j<n; j++)
		{
			if((mas[i].first+mas[j].first)%2==0 && (mas[i].second+mas[j].second)%2==0)
			{
				buf.push_back(mp<int,int> ((mas[i].first+mas[j].first)/2,(mas[i].second+mas[j].second)/2));
			}
		}
	}
	for(int i=0; i<n; i++)
	{
		for(int j=0; j<buf.size(); j++)
		{
			if(mas[i].first==mas[j].first && mas[i].second==mas[j].second)
			{
				S++;
				break;
			}
		}
	}

	cout<<S;
	return 0;

}


#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT","r",stdin);
	//freopen("OUTPUT.TXT","w",stdout);
	#endif
	int n;
	cin>>n;
	set< pair<int,int> > t;
	vector<pair<int,int> > mas(n);
	for(int i=0; i<n; i++)
	{
		cin>>mas[i].first>>mas[i].second;
		t.insert(mas[i]);
	}
	long long S=0;
	sort(mas.begin(),mas.end());
	vector<pair<int,int> > buf;
	for(int i=0; i<n-1; i++)
	{
		for(int j=i+1; j<n; j++)
		{
			if((mas[i].first+mas[j].first)%2==0 && (mas[i].second+mas[j].second)%2==0)
			{
				buf.push_back(mp<int,int> ((mas[i].first+mas[j].first)/2,(mas[i].second+mas[j].second)/2));
			}
		}
	}
		for(int j=0; j<buf.size(); j++)
		{
			if ( t.find ( mp(buf[j].first,buf[j].second) ) != t.end() ) S++;
		}
	cout<<S;
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
bool d[3000][3000];
int main ()
{
long long i,j,n,m,k,ot=0;
vector <pair <long long,long long> > s;
pair <long long, long long> a;

cin>>n;
for (i=0;i<3000;i++)
{
for (j=0;j<3000;j++)
{
	d[i][j]=false;
}
}
for (i=0;i<n;i++)
{
	cin>>a.second>>a.first;
	d[a.first+1001][a.second+1001]=true;
	a.second=a.second+1001;
	a.first=a.first+1001;
	s.push_back(a);
}
for (i=0;i<n;i++)
{
	for (j=0;j<n;j++)
	{
		if (i!=j)
		{
			if ((2*s[i].first-s[j].first>=0) && (2*s[i].second-s[j].second>=0) && (d[2*s[i].first-s[j].first][2*s[i].second-s[j].second]==true)) ot++;
		}
	}
}
ot=ot/2;
cout<<ot;
return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
bool d[3000][3000];
int main ()
{
long long i,j,n,m,k,ot=0;
vector <pair <long long,long long> > s;
pair <long long, long long> a;

cin>>n;
for (i=0;i<3000;i++)
{
for (j=0;j<3000;j++)
{
	d[i][j]=false;
}
}
for (i=0;i<n;i++)
{
	cin>>a.second>>a.first;
	d[a.first+1001][a.second+1001]=true;
	a.second=a.second+1001;
	a.first=a.first+1001;
	s.push_back(a);
}
for (i=0;i<n;i++)
{
	for (j=0;j<n;j++)
	{
		if (i!=j)
		{
			if (d[2*s[i].first-s[j].first][2*s[i].second-s[j].second]==true) ot++;
		}
	}
}
ot=ot/2;
cout<<ot;
return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
bool d[6000][6000];
int main ()
{
long long i,j,n,m,k,ot=0;
vector <pair <long long,long long> > s;
pair <long long, long long> a;

cin>>n;
for (i=0;i<3000;i++)
{
for (j=0;j<3000;j++)
{
	d[i][j]=false;
}
}
for (i=0;i<n;i++)
{
	cin>>a.second>>a.first;
	d[a.first+1001][a.second+1001]=true;
	a.second=a.second+1001;
	a.first=a.first+1001;
	s.push_back(a);
}
for (i=0;i<n;i++)
{
	for (j=0;j<n;j++)
	{
		if (i!=j)
		{
			if ((2*s[i].first-s[j].first<5000) && (2*s[i].second-s[j].second<5000) && (2*s[i].first-s[j].first>=0) && (2*s[i].second-s[j].second>=0) && (d[2*s[i].first-s[j].first][2*s[i].second-s[j].second]==true)) ot++;
		}
	}
}
ot=ot/2;
cout<<ot;
return 0;
}


#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <map>
using namespace std;
const int mod=(1<<30)+1,null=1500;

int n,y[3007],x[3007];
//vector<vector<int>>v;
//vector<int>one(2);
vector<int>v[3000];

void sol(){
    int i,l,r,x0,y0,j,m,s=0;
    for(i=0;i<3000;i++)v[i].clear();
    for(i=0;i<n;i++){
        scanf("%d%d",&x[i],&y[i]);
        v[null+x[i]].push_back(y[i]);
    }
    for(i=0;i<3000;i++)sort(v[i].begin(),v[i].end());
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            if((x[i]+x[j])%2==0&&(y[i]+y[j])%2==0){
                x0=(x[i]+x[j])/2;
                y0=(y[i]+y[j])/2;
                l=0;
                r=v[x0+null].size()-1;
                while((r-l)>1){
                    m=(r+l)/2;
                    if(v[x0+null][m]<=y0){
                        l=m;
                    }else{
                        r=m;
                    }
                }
                if(y0==v[x0+null][l])s++;
            }
        }
    }
    printf("%d\n",s);
}

int main(){
#pragma comment(linker, "/STACK:1073741824")
#ifndef ONLINE_JUDGE
    freopen("input.txt","rt",stdin);
    freopen("output.txt","wt",stdout);
#endif
    while(scanf("%d",&n)!=EOF)sol();
    return 0;
}


#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <map>
using namespace std;
const int mod=(1<<30)+1,null=1500;

int n,y[3007],x[3007];
//vector<vector<int>>v;
//vector<int>one(2);
vector<int>v[3000];

void sol(){
    int i,l,r,x0,y0,j,m,s=0;
    for(i=0;i<3000;i++)v[i].clear();
    for(i=0;i<n;i++){
        scanf("%d%d",&x[i],&y[i]);
        v[null+x[i]].push_back(y[i]);
    }
    for(i=0;i<3000;i++)sort(v[i].begin(),v[i].end());
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            if((x[i]+x[j])%2==0&&(y[i]+y[j])%2==0){
                x0=(x[i]+x[j])/2;
                y0=(y[i]+y[j])/2;
                if(v[x0+null].size()!=0){
                    l=0;
                    r=v[x0+null].size()-1;
                    while((r-l)>1){
                        m=(r+l)/2;
                        if(v[x0+null][m]<=y0){
                            l=m;
                        }else{
                            r=m;
                        }
                    }
                    if(y0==v[x0+null][l])s++;
                    if(y0==v[x0+null][r]&&l!=r)s++;
                }
            }
        }
    }
    printf("%d\n",s);
}

int main(){
#pragma comment(linker, "/STACK:1073741824")
#ifndef ONLINE_JUDGE
    freopen("input.txt","rt",stdin);
    freopen("output.txt","wt",stdout);
#endif
    while(scanf("%d",&n)!=EOF)sol();
    return 0;
}


#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <map>
using namespace std;
const int mod=(1<<30)+1,null=1500;

int n,y[3007],x[3007];
//vector<vector<int>>v;
//vector<int>one(2);
vector<int>v[3000];

void sol(){
    int i,l,r,x0,y0,j,m,s=0;
    for(i=0;i<3000;i++)v[i].clear();
    for(i=0;i<n;i++){
        scanf("%d%d",&x[i],&y[i]);
        v[null+x[i]].push_back(y[i]);
    }
    for(i=0;i<3000;i++)sort(v[i].begin(),v[i].end());
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            if((x[i]+x[j])%2==0&&(y[i]+y[j])%2==0){
                x0=(x[i]+x[j])/2;
                y0=(y[i]+y[j])/2;
                l=0;
                r=v[x0+null].size()-1;
                while((r-l)>1){
                    m=(r+l)/2;
                    if(v[x0+null][m]<=y0){
                        l=m;
                    }else{
                        r=m;
                    }
                }
                if(y0==v[x0+null][l])s++;
                if(y0==v[x0+null][r]&&l!=r)s++;
            }
        }
    }
    printf("%d\n",s);
}

int main(){
#pragma comment(linker, "/STACK:1073741824")
#ifndef ONLINE_JUDGE
    freopen("input.txt","rt",stdin);
    freopen("output.txt","wt",stdout);
#endif
    while(scanf("%d",&n)!=EOF)sol();
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef vector< int > VI;
typedef vector< string > VS;
typedef pair< int, int > II;
typedef long long LL;
#define FOR(i,b,e) for(int (i)=(int)(b);(i)<(int)(e);++(i))
#define FORIT(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define INF 987654321

int a[4004][4004];

int main()
{
    int n;
    cin >> n;
    VI x(n), y(n);
    FOR(i, 0, n)
        cin >> x[i] >> y[i];
    memset(a, 0, sizeof(a));
    FOR(i, 0, n)
        FOR(j, i+1, n) {
            int mx = x[i]+x[j]+2000, my = y[i]+y[j]+2000;
            a[my][mx] = 1;
        }
    int ans = 0;
    FOR(i, 0, n) {
        int tx = 2*(x[i]+1000), ty = 2*(y[i]+1000);
        if (a[ty][tx]) ++ans;
    }
    cout << ans << endl;
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef vector< int > VI;
typedef vector< string > VS;
typedef pair< int, int > II;
typedef long long LL;
#define FOR(i,b,e) for(int (i)=(int)(b);(i)<(int)(e);++(i))
#define FORIT(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define INF 987654321

int a[4004][4004];

int main()
{
    int n;
    cin >> n;
    VI x(n), y(n);
    FOR(i, 0, n)
        cin >> x[i] >> y[i];
    memset(a, 0, sizeof(a));
    FOR(i, 0, n)
        a[2*y[i]+2000][2*x[i]+2000] = 1;
    int ans = 0;
    FOR(i, 0, n)
        FOR(j, i+1, n) {
            int mx = x[i]+x[j]+2000, my = y[i]+y[j]+2000;
            if (a[my][mx]) ++ans;
        }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <algorithm>

using namespace std;

#define maxn

struct Point {
	double x, y;
	Point(double X = 0, double Y = 0) {
		x = X;
		y = Y;
	}
	bool operator< (const Point& T) {
		if (x == T.x)
			return y < T.y;
		else
			return x < T.x;
	}
	bool operator== (const Point& T) {
		if (x == T.x && y == T.y)
			return true;
		else
			return false;
	}
};

int n;

vector <Point> a;

int ans;

int main() {
	//freopen("b.in", "r", stdin);
	//freopen("b.out", "w", stdout);

	cin >> n;

	for (int i = 0; i < n; i++) {
		double x, y;
		cin >> x >> y;
		a.push_back(Point(x, y));
	}

	sort(a.begin(), a.end());

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++) {
			Point p1 = a[i];
			Point p2 = a[j];
			double x = (p1.x + p2.x) / 2;
			double y = (p1.y + p2.y) / 2;
			Point z = Point(x, y);
			int l = i;
			int r = j;
			while (l < r - 1) {
				int m = (l + r) / 2;
				if (a[m] == z) {
					ans++;
					break;
				}
				if (a[m].x < z.x)
					l = m;
				else if (a[m].x > z.x)
					r = m;
				else {
					if (a[m].y < z.y)
						l = m;
					else
						r = m;
				}
			}
		}

		cout << ans;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>

using namespace std;

struct point
{
	int x;int y;
};

bool le(const point& a, const point& b)
{
	if (a.x == b.x) return a.y < b.y;
	return a.x < b.x;
}

int main()
{
	int N;
	vector<point> vp;
	cin >> N;
	vp.resize(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> vp[i].x >> vp[i].y;
	}
	sort(vp.begin(), vp.end(), le);
	int ans = 0;
	for (int i = 0; i < N - 2; ++i)
		for (int j = i + 1; j < N - 1; ++j)
		{
			point t;
			t.x = 2 * vp[j].x - vp[i].x;
			t.y = 2 * vp[j].y - vp[i].y;
			if (binary_search(vp.begin(), vp.end(), t, le)) ans++;
		}
	cout << ans << endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>

using namespace std;

struct point
{
	int x;int y;
};

bool le(const point& a, const point& b)
{
	if (a.x == b.x) return a.y < b.y;
	return a.x < b.x;
}

int main()
{
	int N;
	vector<point> vp;
	cin >> N;
	vp.resize(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> vp[i].x >> vp[i].y;
	}
	sort(vp.begin(), vp.end(), le);
	int ans = 0;
	for (int i = 0; i < N - 2; ++i)
		for (int j = i + 1; j < N - 1; ++j)
		{
			point t;
			t.x = 2 * vp[j].x - 2 * vp[i].x;
			t.y = 2 * vp[j].y - 2 * vp[i].y;
			if (binary_search(vp.begin(), vp.end(), t, le)) ans++;
		}
	cout << ans << endl;
	return 0;
}


// B.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <cmath>
#include <map>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <iostream>
#include <cstring>
#include <string>

using namespace std;

struct point
{
	int x;
	int y;
};

int main()
{
	int n;
	int x,y;
	scanf("%d",&n);
	map<pair<int,int>,int> list;
	point a[3005];
	long long res=0;
	for(int i=0;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		a[i].x=x;
		a[i].y=y;
	}//for(int =0;i<n;i++)

	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(!((a[i].x+a[j].x)%2!=0 || (a[i].y+a[j].y)%2!=0))
			{
				int xn=(a[i].x+a[j].x)/2;
				int yn=(a[i].y+a[j].y)/2;
				list[make_pair(xn,yn)]++;
			}
		}
	}

	for(int i=0;i<n;i++)
	{
		if(list[make_pair(a[i].x,a[i].y)]>0)
		{
			res+=list[make_pair(a[i].x,a[i].y)];
		}
	}

	cout<<res;
	return 0;
}


#include <stdio.h>
#include <cmath>
#include <map>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <iostream>
#include <cstring>
#include <string>

using namespace std;

struct point
{
	int x;
	int y;
};

int list[3005][3005];

int main()
{
	int n;
	int x,y;
	scanf("%d",&n);

	point a[3005];
	long long res=0;
	for(int i=0;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		a[i].x=x;
		a[i].y=y;
	}//for(int =0;i<n;i++)

	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(!((a[i].x+a[j].x)%2!=0 || (a[i].y+a[j].y)%2!=0))
			{
				int xn=(a[i].x+a[j].x)/2;
				int yn=(a[i].y+a[j].y)/2;
				list[xn+1000][yn+1000]++;
			}
		}
	}

	for(int i=0;i<n;i++)
	{
		if(list[a[i].x+1000][a[i].y+1000]>0)
		{
			res+=list[a[i].x+1000][a[i].y+1000];
		}
	}

	cout<<res;
	return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
struct point
{
  int u;
}p[3004];
int main()
{
    int n;
    //freopen("in.txt","r",stdin);
   // freopen("out.txt","w",stdout);
    while(~scanf("%d",&n))
    {
     int i,j,x,y;
     for(i=0;i<=2001;i++)
       p[i].u=0;
     for(i=0;i<n;i++)
     {
      scanf("%d%d",&x,&y);
      p[y+1000].u=x+1001;
     }
    int res=0;
    for(i=0;i<=2000;i++)
     for(j=i+1;j<=2000&&2*j-i<=2000;j++)
     {
      if(p[i].u&&p[j].u&&(p[2*j-i].u==2*p[j].u-p[i].u)&&p[2*j-i].u)
       res++;
     }
     printf("%d\n",res);
   }
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
struct point
{
       int x,y;
       void iint()
       {
            x=0;y=0;
        }
}num[3005];
int mid[2005][2005];
void inint()
{//cout<<"l";
  for(int i=0;i<3005;i++)
  {
        num[i].iint();
  }
  memset(mid,0,sizeof(mid));
}
int main()
{
    int n;
    while(scanf("%d",&n)==1)
    {
     int i,j,x,y,xx,yy;
     inint();
     for(i=0;i<n;i++)
      { scanf("%d %d",&num[i].x,&num[i].y); mid[num[i].x+1000][num[i].y+1000]=1;}
    int sum=0;
    for(i=0;i<n;i++)
     for(j=i+1;j<n;j++)
     {
                        x=num[i].x+num[j].x;
                        y=num[i].y+num[j].y;
                        if(x%2!=0||y%2!=0)continue;
                        //cout<<x<<y<<endl;
                        xx=x/2;yy=y/2;
                        xx+=1000;yy+=1000;
                        //cout<<mid[xx][yy]<<endl;
                        if(mid[xx][yy]==1)
                        sum++;
     }
     printf("%d\n",sum);
   }
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
struct point {
       int u;
       }p[2004];
int cmp(point a,point b)
{
    return a.u<b.u;
}
int main()
{
    int n;
   // freopen("in.txt","r",stdin);
   // freopen("out.txt","w",stdout);
    while(~scanf("%d",&n))
    {
     int i,j,x,y;
     for(i=0;i<=2001;i++)
       p[i].u=0;
     for(i=0;i<n;i++)
     {
      scanf("%d%d",&x,&y);
      p[y+1000].u=x+1001;
     }
    int res=0;
    for(i=0;i<=2000;i++)
     for(j=i+1;j<=2000&&2*j-i<=2000;j++)
     {
      if(p[i].u&&p[j].u&&(p[2*j-i].u==2*p[j].u-p[i].u))
       res++;
     }
     printf("%d\n",res);
   }
}

�����  0:46:57
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
struct point
{
  int u;
}p[3004];
int main()
{
    int n;
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    while(~scanf("%d",&n))
    {
     int i,j,x,y;
     for(i=0;i<=2001;i++)
       p[i].u=0;
     for(i=0;i<n;i++)
     {
      scanf("%d%d",&x,&y);
      p[y+1000].u=x+1001;
     }
    int res=0;
    for(i=0;i<=2000;i++)
     for(j=i+1;j<=2000&&2*j-i<=2000;j++)
     {
      if(p[i].u&&p[j].u&&(p[2*j-i].u==2*p[j].u-p[i].u)&&p[2*j-i].u)
       res++;
     }
     printf("%d\n",res);
   }
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
struct point {
       int u;
       }p[2004];
int cmp(point a,point b)
{
    return a.u<b.u;
}
int main()
{
    int n;
   // freopen("in.txt","r",stdin);
   // freopen("out.txt","w",stdout);
    while(~scanf("%d",&n))
    {
     int i,j,x,y;
     for(i=0;i<=2001;i++)
       p[i].u=0;
     for(i=0;i<n;i++)
     {
      scanf("%d%d",&x,&y);
      p[y+1000].u=x+1001;
     }
    int res=0;
    for(i=0;i<=2000;i++)
     for(j=i+1;j<=2000&&2*j-i<=2000;j++)
     {
      if(p[i].u&&p[j].u&&(p[2*j-i].u==2*p[j].u-p[i].u))
       res++;
     }
     printf("%d\n",res);
   }
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<cstdlib>
using namespace std;
const int N = 2005;
bool map[N][N]={0};
int x[N+1000];
int y[N+1000];
int main()
{
	int i,j,k,n,tx,ty;
	while(~scanf("%d",&n))
	{
		memset(map,0,sizeof(map));
		for(i=0;i<n;i++)
		{
			scanf("%d%d",x+i,y+i);
			x[i]+=1000;
			y[i]+=1000;
			map[x[i]][y[i]]=true;
		}
		int ans=0;
		for(i=0;i<n;i++)
		{
			//printf("%d %d\n",x[i],y[i]);
			for(j=i+1;j<n;j++)
			{
				tx=x[i]+x[j];
				ty=y[i]+y[j];
				if(!(tx&1)&&!(ty&1))
				{
					tx>>=1;
					ty>>=1;
					ans+=map[tx][ty];
					//printf("%d\n",map[tx][ty]);
				}
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <algorithm>
#define point pair <double,double>

using namespace std ;

int main() {

	int n ;
	double x , y , x2 , y2 ;
	cin >> n ;
	set <point> all ;
	vector <point> p ;
	for ( int i = 0 ; i < n ; i ++ ) {
		cin >> x >> y ;
		all.insert ( point ( x , y ) ) ;
		p.push_back ( point ( x , y ) ) ;
	}

	int cnt = 0 ;

	sort ( p.begin() , p.end() ) ;

	set <point>::iterator tmp ;

	for ( int i = 0 ; i < n ; i ++ )
		for ( int j = i + 1 ; j < n ; j ++ ) {
			if ( all.find ( point ( (p[i].first + p[j].first )/2 , (p[i].second + p[j].second)/2 ) ) != all.end() )
				cnt ++ ;
		}

	cout << cnt << endl ;

	return 0 ;
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
    // var
    int n, temp_X, temp_Y, counter;
    vector<int> X_Coord;
    vector<int> Y_Coord;

    // input
    cin >> n;
    for (int i=0; i<n; i++)
    {
        cin >> temp_X >> temp_Y;
        X_Coord.push_back(temp_X);
        Y_Coord.push_back(temp_Y);
    }

//    // sort points by x coordinate, then by y coordinate
//    for (int i=0; i<n; i++)
//    {
//        for (int j=0; j<n-1; j++)
//        {
//            if (X_Coord[j] > X_Coord[j+1] || (X_Coord[j] == X_Coord[j+1] && Y_Coord[j] > Y_Coord[j+1]))
//            {
//                temp_X = X_Coord[j];
//                X_Coord[j] = X_Coord[j+1];
//                X_Coord[j+1] = temp_X;
//
//                temp_Y = Y_Coord[j];
//                Y_Coord[j] = Y_Coord[j+1];
//                Y_Coord[j+1] = temp_Y;
//            }
//        }
//    }

    // check points
    counter = 0;
    for (int i=0; i<n-2; i++)
    {
        for (int j=i+1; j<n-1; j++)
        {
            for (int k=j+1; k<n; k++)
            {
                if (X_Coord[i] + X_Coord[k] == 2 * X_Coord[j] && Y_Coord[i] + Y_Coord[k] == 2 * Y_Coord[j])
                {
                    counter++;
                }
                if (X_Coord[i] + X_Coord[j] == 2 * X_Coord[k] && Y_Coord[i] + Y_Coord[j] == 2 * Y_Coord[k])
                {
                    counter++;
                }
                if (X_Coord[j] + X_Coord[k] == 2 * X_Coord[i] && Y_Coord[j] + Y_Coord[k] == 2 * Y_Coord[i])
                {
                    counter++;
                }
            }
        }
    }

    cout << counter << endl;

    return 0;

}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
    // var
    int n, temp_X, temp_Y, counter;
    vector<int> X_Coord;
    vector<int> Y_Coord;
    int xi, xj, xk, yi, yj, yk;

    // input
    cin >> n;
    for (int i=0; i<n; i++)
    {
        cin >> temp_X >> temp_Y;
        X_Coord.push_back(temp_X);
        Y_Coord.push_back(temp_Y);
    }

//    // sort points by x coordinate, then by y coordinate
//    for (int i=0; i<n; i++)
//    {
//        for (int j=0; j<n-1; j++)
//        {
//            if (X_Coord[j] > X_Coord[j+1] || (X_Coord[j] == X_Coord[j+1] && Y_Coord[j] > Y_Coord[j+1]))
//            {
//                temp_X = X_Coord[j];
//                X_Coord[j] = X_Coord[j+1];
//                X_Coord[j+1] = temp_X;
//
//                temp_Y = Y_Coord[j];
//                Y_Coord[j] = Y_Coord[j+1];
//                Y_Coord[j+1] = temp_Y;
//            }
//        }
//    }

    // check points
    counter = 0;
    for (int i=0; i<n-2; i++)
    {
        xi = X_Coord[i];
        yi = Y_Coord[i];
        for (int j=i+1; j<n-1; j++)
        {
            xj = X_Coord[j];
            yj = Y_Coord[j];
            for (int k=j+1; k<n; k++)
            {
                xk = X_Coord[k];
                yk = Y_Coord[k];
                if (xi + xk == 2 * xj && yi + yk == 2 * yj)
                {
                    counter++;
                }
                if (xi + xj == 2 * xk && yi + yj == 2 * yk)
                {
                    counter++;
                }
                if (xj + xk == 2 * xi && yj + yk == 2 * yi)
                {
                    counter++;
                }
            }
        }
    }

    cout << counter << endl;

    return 0;

}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
    // var
    int n, x, y, ans;
    int Plane[2001][2001] = {0};
    vector<int> X_Coord;
    vector<int> Y_Coord;

    //return 0;

    // input
    cin >> n;
    for (int i=0; i<n; i++)
    {
        cin >> x >> y;
        x = x + 1000;
        y = y + 1000;
        X_Coord.push_back(x);
        Y_Coord.push_back(y);
        Plane[x][y]++;
    }

    // check points
    ans = 0;
    for (int i=0; i<n-1; i++)
    {
        for (int j=i+1; j<n; j++)
        {
            x = X_Coord[i] + X_Coord[j];
            y = Y_Coord[i] + Y_Coord[j];

            if (x % 2 == 0 && y % 2 == 0 && Plane[x/2][y/2] > 0)
            {
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;

}