#include <bits/stdc++.h>
using namespace std;
long long x[2005];
long long y[2005];
struct l {
  int st;
  int en;
  long long dis;
} line[4000100];
int vis[4000100];
long long cmp(l aa, l bb) { return aa.dis < bb.dis; }
int main() {
  int n;
  while (~scanf("%d", &n)) {
    memset(vis, 0, sizeof(vis));
    for (int i = 1; i <= n; i++) scanf("%lld%lld", &x[i], &y[i]);
    int cnt = 1;
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        line[cnt].st = i;
        line[cnt].en = j;
        line[cnt++].dis =
            (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
      }
    }
    sort(line + 1, line + cnt, cmp);
    vis[1] = 1;
    for (int i = 2; i < cnt; i++) {
      if (line[i].dis == line[i - 1].dis)
        vis[i] = vis[i - 1];
      else
        vis[i] = i;
    }
    int ans = 0;
    for (int i = 1; i < cnt; i++) {
      for (int j = vis[i]; j < cnt; j++) {
        if (line[j].dis > line[i].dis) break;
        if (line[j].st == line[i].en || line[j].en == line[i].st ||
            line[j].st == line[i].st || line[j].en == line[i].en)
          continue;
        int x1 = line[i].st;
        int y1 = line[i].en;
        int x2 = line[j].st;
        int y2 = line[j].en;
        if ((x[x1] - x[y1]) * (y[x2] - y[y2]) ==
            (y[x1] - y[y1]) * (x[x2] - x[y2]))
          ans++;
      }
    }
    printf("%d\n", ans / 4);
  }
}

### Prompt

Construct a CPP code solution to the problem outlined:

You are given n points on a plane. All the points are distinct and no three of them lie on the same line. Find the number of parallelograms with the vertices at the given points.

Input

The first line of the input contains integer n (1 ≤ n ≤ 2000) — the number of points.

Each of the next n lines contains two integers (xi, yi) (0 ≤ xi, yi ≤ 109) — the coordinates of the i-th point.

Output

Print the only integer c — the number of parallelograms with the vertices at the given points.

Example

Input

4
0 1
1 0
1 1
2 0


Output

1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long x[2005];
long long y[2005];
struct l {
  int st;
  int en;
  long long dis;
} line[4000100];
int vis[4000100];
long long cmp(l aa, l bb) { return aa.dis < bb.dis; }
int main() {
  int n;
  while (~scanf("%d", &n)) {
    memset(vis, 0, sizeof(vis));
    for (int i = 1; i <= n; i++) scanf("%lld%lld", &x[i], &y[i]);
    int cnt = 1;
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        line[cnt].st = i;
        line[cnt].en = j;
        line[cnt++].dis =
            (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
      }
    }
    sort(line + 1, line + cnt, cmp);
    vis[1] = 1;
    for (int i = 2; i < cnt; i++) {
      if (line[i].dis == line[i - 1].dis)
        vis[i] = vis[i - 1];
      else
        vis[i] = i;
    }
    int ans = 0;
    for (int i = 1; i < cnt; i++) {
      for (int j = vis[i]; j < cnt; j++) {
        if (line[j].dis > line[i].dis) break;
        if (line[j].st == line[i].en || line[j].en == line[i].st ||
            line[j].st == line[i].st || line[j].en == line[i].en)
          continue;
        int x1 = line[i].st;
        int y1 = line[i].en;
        int x2 = line[j].st;
        int y2 = line[j].en;
        if ((x[x1] - x[y1]) * (y[x2] - y[y2]) ==
            (y[x1] - y[y1]) * (x[x2] - x[y2]))
          ans++;
      }
    }
    printf("%d\n", ans / 4);
  }
}

```