#include <bits/stdc++.h>
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
const int maxn = (int)1e5 + 5;
const long long INF = 0x3f3f3f3f3f3f3f3f;
using namespace std;
int x[3005], y[3005];
int vis[5005][5005];
int main() {
  int n;
  scanf("%d", &n);
  int a, b;
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &a, &b);
    x[i] = a + 1000;
    y[i] = b + 1000;
    vis[x[i]][y[i]] = 1;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i == j) continue;
      if ((x[i] + x[j]) % 2 || (y[i] + y[j]) % 2) continue;
      int xx = (x[i] + x[j]) / 2;
      int yy = (y[i] + y[j]) / 2;
      if (vis[xx][yy] == 1) ans++;
    }
  }
  printf("%d\n", ans / 2);
  return 0;
}

### Prompt

In Cpp, your task is to solve the following problem:

You are given n points on a plane. All points are different.

Find the number of different groups of three points (A, B, C) such that point B is the middle of segment AC. 

The groups of three points are considered unordered, that is, if point B is the middle of segment AC, then groups (A, B, C) and (C, B, A) are considered the same.

Input

The first line contains a single integer n (3 ≤ n ≤ 3000) — the number of points. 

Next n lines contain the points. The i-th line contains coordinates of the i-th point: two space-separated integers xi, yi ( - 1000 ≤ xi, yi ≤ 1000).

It is guaranteed that all given points are different.

Output

Print the single number — the answer to the problem. 

Examples

Input

3
1 1
2 2
3 3


Output

1


Input

3
0 0
-1 0
0 1


Output

0

### Response

```cpp
#include <bits/stdc++.h>
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
const int maxn = (int)1e5 + 5;
const long long INF = 0x3f3f3f3f3f3f3f3f;
using namespace std;
int x[3005], y[3005];
int vis[5005][5005];
int main() {
  int n;
  scanf("%d", &n);
  int a, b;
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &a, &b);
    x[i] = a + 1000;
    y[i] = b + 1000;
    vis[x[i]][y[i]] = 1;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i == j) continue;
      if ((x[i] + x[j]) % 2 || (y[i] + y[j]) % 2) continue;
      int xx = (x[i] + x[j]) / 2;
      int yy = (y[i] + y[j]) / 2;
      if (vis[xx][yy] == 1) ans++;
    }
  }
  printf("%d\n", ans / 2);
  return 0;
}

```