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 (x_{i}, y_{i}) (0 ≤ x_{i}, y_{i} ≤ 10^9) — 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

Difficulty: HARD
Tags: Geometry

Starter code:

Solutions:
n = int(input())
l = []
l1 = [1] * n ** 2
ans = 0
for i in range(n):
	(x, y) = input().split()
	(x, y) = [int(x), int(y)]
	l.append([x, y])
from collections import Counter
count = Counter()
for i in range(len(l)):
	for j in range(i + 1, len(l)):
		count[l[i][0] + l[j][0], l[j][1] + l[i][1]] += 1
ans = sum((i * (i - 1) // 2 for i in list(count.values())))
print(ans)


def main():
	from collections import Counter
	(n, cnt, l) = (int(input()), Counter(), [])
	for (x, y) in sorted((tuple(map(int, input().split())) for _ in range(n)), reverse=True):
		for (u, v) in l:
			cnt[u - x, v - y] += 1
		l.append((x, y))
	print(sum((i * (i - 1) for i in list(cnt.values()))) // 4)

def __starting_point():
	main()
__starting_point()


n = int(input())
x = []
y = []
for i in range(n):
	x.append(0)
	y.append(0)
	(x[i], y[i]) = list(map(int, input().split()))
from collections import defaultdict
dict = defaultdict(int)
for i in range(n):
	for j in range(i + 1, n):
		tx = x[i] - x[j]
		ty = y[i] - y[j]
		if tx > 0 or (tx == 0 and ty > 0):
			tx = -tx
			ty = -ty
		dict[tx, ty] += 1
ans = 0
for i in list(dict.values()):
	ans += i * (i - 1) // 2
print(ans // 2)


import math
n = int(input())
dots = []
for i in range(n):
	temp = list(map(int, input().split()))
	dots.append(temp)
lines = {}
for i in range(n):
	for j in range(i + 1, n):
		dx = dots[i][0] - dots[j][0]
		dy = dots[i][1] - dots[j][1]
		if dx < 0:
			dx = -dx
			dy = -dy
		if dx == 0 and dy < 0:
			dy = -dy
		if (dx, dy) in lines:
			lines[dx, dy] += 1
		else:
			lines[dx, dy] = 1
ans = 0
for x in lines:
	t = lines[x]
	ans += t * (t - 1) / 2
ans /= 2
print(int(ans))


from collections import defaultdict
n = int(input())
C = []
cnt = 0
D = defaultdict(int)
for i in range(n):
	C.append([int(i) for i in input().split()])
for i0 in range(n):
	x0 = C[i0][0]
	y0 = C[i0][1]
	for Dots in C[i0 + 1:]:
		x = Dots[0] - x0
		y = Dots[1] - y0
		if x < 0:
			(x, y) = (-x, -y)
		elif x == 0:
			if y < 0:
				y = -y
		cnt += D[x, y]
		D[x, y] += 1
print(int(cnt / 2))


from collections import Counter

def read_ints():
	return [int(x) for x in input().split()]

def main():
	(n,) = read_ints()
	points = []
	for i in range(0, n):
		(x, y) = read_ints()
		points.append((x, y))
	c = Counter()
	for i in range(0, n):
		for j in range(i + 1, n):
			(x1, y1) = points[i]
			(x2, y2) = points[j]
			c[x1 + x2, y1 + y2] += 1
	res = 0
	for (k, v) in c.items():
		res += v * (v - 1)
	res //= 2
	print(res)
main()


(p, d) = ([], {})
s = 0
for i in range(int(input())):
	(x, y) = map(int, input().split())
	for (a, b) in p:
		q = (a + x, b + y)
		if q not in d:
			d[q] = 0
		s += d[q]
		d[q] += 1
	p.append((x, y))
print(s)


n = int(input())
points = [0] * n
D = {}
for i in range(n):
	points[i] = tuple((int(x) for x in input().split()))
for i in range(n):
	for j in range(i + 1, n):
		(x1, y1) = points[i]
		(x2, y2) = points[j]
		(u, v) = (x2 - x1, y2 - y1)
		if u < 0 or (u == 0 and v < 0):
			(u, v) = (-u, -v)
		if (u, v) in D:
			D[u, v] += 1
		else:
			D[u, v] = 1
S = sum((D[i] * (D[i] - 1) // 2 for i in D))
print(S // 2)


from collections import Counter

def main():
	n = int(input())
	x = []
	y = []
	a = Counter()
	for i in range(n):
		x.append(0)
		y.append(0)
		(x[i], y[i]) = map(int, input().split())
	for i in range(n):
		for j in range(i + 1, n):
			a[x[i] + x[j], y[i] + y[j]] += 1
	ans = 0
	for (q, p) in a.items():
		ans += p * (p - 1)
	ans //= 2
	print(ans)
main()


import sys
from collections import namedtuple
Point = namedtuple('Point', 'x y')
numPoints = int(sys.stdin.readline().rstrip())
Points = []
MidPoints = {}
for _ in range(numPoints):
	line = sys.stdin.readline().rstrip()
	xy = line.split(' ')
	t = Point(int(xy[0]), int(xy[1]))
	Points.append(t)
	for p in Points:
		mid = Point(t.x + p.x, t.y + p.y)
		if MidPoints.__contains__(mid):
			MidPoints[mid] += 1
		else:
			MidPoints[mid] = 1
paras = 0
for k in MidPoints.keys():
	paras += MidPoints[k] * (MidPoints[k] - 1) / 2
sys.stdout.write(str(int(paras)))
sys.stdout.flush()


n = int(input())
dc = {}
P = []
for i in range(n):
	(x, y) = map(int, input().split())
	P.append([x, y])
for i in range(n):
	for j in range(i + 1, n):
		(x1, y1) = P[i]
		(x2, y2) = P[j]
		if (x1 + x2, y1 + y2) not in dc:
			dc[x1 + x2, y1 + y2] = 0
		dc[x1 + x2, y1 + y2] += 1
ans = 0
for x in dc:
	ans += dc[x] * (dc[x] - 1)
print(ans // 2)


import sys
from collections import Counter
n = int(input())
a = [list(map(int, line.split())) for line in sys.stdin]
cnt = Counter()
for (i, (sx, sy)) in enumerate(a):
	for (tx, ty) in a[i + 1:]:
		if sx < tx:
			cnt[tx - sx, ty - sy] += 1
		elif sx > tx:
			cnt[sx - tx, sy - ty] += 1
		else:
			cnt[0, abs(sy - ty)] += 1
ans = 0
for v in cnt.values():
	ans += v * (v - 1) >> 1
print(ans >> 1)


n = int(input())
points = []
cnt = {}
for i in range(n):
	(x, y) = map(int, input().split())
	for (a, b) in points:
		(u, v) = (x - a, y - b)
		q = (u / v if v else int(2000000000.0), u * u + v * v)
		cnt[q] = cnt.get(q, 0) + 1
	points.append((x, y))
print(sum((k * k - k for k in cnt.values())) // 4)


n = int(input())
midPoint = dict()
points = []
for i in range(n):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	points.append((x, y))
answer = 0
for i in range(len(points)):
	for j in range(i + 1, len(points)):
		mid = (points[i][0] + points[j][0], points[i][1] + points[j][1])
		if midPoint.get(mid, 0) == 0:
			midPoint[mid] = 0
		answer += midPoint[mid]
		midPoint[mid] += 1
print(int(answer))


(p, d) = ([], {})
for i in range(int(input())):
	(x, y) = map(int, input().split())
	for (a, b) in p:
		(u, v) = (a - x, b - y)
		q = (u / v if v else int(2000000000.0), u * u + v * v)
		d[q] = d.get(q, 0) + 1
	p.append((x, y))
print(sum((k * k - k for k in d.values())) // 4)


from sys import stdin
from collections import defaultdict
line = stdin.readline().rstrip()
n = int(line)
a = []
for line in stdin.readlines():
	line = line.rstrip()
	(start, end) = [int(x) for x in line.split(' ')]
	a.append((start, end))
m = defaultdict(int)
for (i, k) in enumerate(a):
	(x1, y1) = k
	for j in range(i + 1, len(a)):
		(x2, y2) = a[j]
		m[x1 + x2, y1 + y2] += 1
ct = 0
for (k, v) in m.items():
	ct += v * (v - 1) // 2
print(ct)


def main():
	read = lambda : list(map(int, input().split()))
	n = int(input())
	p = [tuple(read()) for i in range(n)]
	from collections import Counter
	cnt = Counter()
	for i in range(n):
		(x, y) = (p[i][0], p[i][1])
		for j in range(i + 1, n):
			cnt[x + p[j][0], y + p[j][1]] += 1
	ans = sum((i * (i - 1) // 2 for i in list(cnt.values())))
	print(ans)
main()


n = int(input())
m = list((tuple(map(int, input().split())) for _ in range(n)))
mid = {}
pall = 0
for i in range(n):
	for j in range(i + 1, n):
		if ((m[i][0] + m[j][0]) / 2, (m[i][1] + m[j][1]) / 2) in mid:
			pall += mid[(m[i][0] + m[j][0]) / 2, (m[i][1] + m[j][1]) / 2]
			mid[(m[i][0] + m[j][0]) / 2, (m[i][1] + m[j][1]) / 2] += 1
		else:
			mid[(m[i][0] + m[j][0]) / 2, (m[i][1] + m[j][1]) / 2] = 1
print(pall)


read = lambda : map(int, input().split())
n = int(input())
p = [tuple(read()) for i in range(n)]
from collections import Counter
cnt = Counter()
for i in range(n):
	for j in range(i + 1, n):
		cnt[p[i][0] + p[j][0], p[i][1] + p[j][1]] += 1
ans = sum((i * (i - 1) // 2 for i in cnt.values()))
print(ans)


import sys

def read_input(input_path=None):
	if input_path is None:
		f = sys.stdin
	else:
		f = open(input_path, 'r')
	n = int(f.readline())
	points = list()
	for _ in range(n):
		(x, y) = map(int, f.readline().split())
		points.append((x, y))
	return (n, points)

def sol(n, points):
	res = 0
	mid_points = dict()
	for i in range(n):
		for j in range(i + 1, n):
			mid = (points[i][0] + points[j][0], points[i][1] + points[j][1])
			if mid not in mid_points:
				mid_points[mid] = 0
			res += mid_points[mid]
			mid_points[mid] += 1
	return [f'{res}']

def solve(input_path=None):
	return sol(*read_input(input_path))

def main():
	for line in sol(*read_input()):
		print(f'{line}')
main()


n = int(input())

def inp(n):
	coor = [[int(i) for i in input().split()] for j in range(n)]
	return coor
coor = inp(n)

def newlist(a):
	d = {}
	s = len(a)
	for i in range(1, s):
		for j in range(i):
			if (a[i][0] + a[j][0], a[i][1] + a[j][1]) in d:
				d[a[i][0] + a[j][0], a[i][1] + a[j][1]] += 1
			else:
				d[a[i][0] + a[j][0], a[i][1] + a[j][1]] = 1
	return d

def newd(d):
	sum2 = 0
	for l in d:
		sum2 += d[l] * (d[l] - 1) / 2
	return int(sum2)
print(newd(newlist(coor)))


def middle(a, b):
	return ((b[0] + a[0]) / 2, (b[1] + a[1]) / 2)

def solve(n, points):
	middles = dict()
	solutions = 0
	for i in range(n - 1):
		for j in range(i + 1, n):
			s = middle(points[i], points[j])
			solutions += middles.setdefault(s, 0)
			middles[s] += 1
	return solutions
n = int(input())
points = list()
for _ in range(n):
	points.append(tuple(map(int, input().split())))
print(solve(n, points))


from sys import stdin, stdout
n = int(stdin.readline())
points = []
for i in range(n):
	(x, y) = map(int, stdin.readline().split())
	points.append((x, y))
points.sort()
pair = {}
for i in range(n):
	for j in range(i + 1, n):
		if (points[j][0] - points[i][0], points[j][1] - points[i][1]) not in pair:
			pair[points[j][0] - points[i][0], points[j][1] - points[i][1]] = 1
		else:
			pair[points[j][0] - points[i][0], points[j][1] - points[i][1]] += 1
ans = 0
for v in pair:
	ans += pair[v] * (pair[v] - 1) // 2
stdout.write(str(ans // 2))


import sys
import bisect
from bisect import bisect_left as lb
input_ = lambda : sys.stdin.readline().strip('\r\n')
from math import log
from math import gcd
from math import atan2, acos
from random import randint
sa = lambda : input_()
sb = lambda : int(input_())
sc = lambda : input_().split()
sd = lambda : list(map(int, input_().split()))
se = lambda : float(input_())
sf = lambda : list(input_())
flsh = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7
gp = []
cost = []
dp = []
mx = []
ans1 = []
ans2 = []
special = []
specnode = []
a = 0
kthpar = []

def dfs(root, par):
	if par != -1:
		dp[root] = dp[par] + 1
	for i in range(1, 20):
		if kthpar[root][i - 1] != -1:
			kthpar[root][i] = kthpar[kthpar[root][i - 1]][i - 1]
	for child in gp[root]:
		if child == par:
			continue
		kthpar[child][0] = root
		dfs(child, root)

def hnbhai():
	n = sb()
	p = []
	for i in range(n):
		p.append(sd())
	d = {}
	for i in range(n):
		for j in range(i + 1, n):
			d[p[i][0] + p[j][0], p[i][1] + p[j][1]] = d.get((p[i][0] + p[j][0], p[i][1] + p[j][1]), 0) + 1
	tot = 0
	for i in d:
		tot += d[i] * (d[i] - 1) // 2
	print(tot)
for _ in range(1):
	hnbhai()


def fu(a, b, c, d):
	if c - a == 0:
		return (0, abs(b - d))
	if (d - b) / (c - a) > 0:
		return (abs(c - a), abs(d - b))
	else:
		return (-1 * abs(c - a), abs(d - b))
import sys
input = sys.stdin.readline
n = int(input())
a = []
for i in range(n):
	a.append(list(map(int, input().split())))
b = {}
for i in range(n):
	for j in range(i + 1, n):
		c = fu(a[i][0], a[i][1], a[j][0], a[j][1])
		if c not in b.keys():
			b[c] = 0
		b[c] += 1
c = 0
for i in b:
	c += b[i] * (b[i] - 1) // 2
print(c // 2)


import sys
from bisect import bisect_right as rb
from collections import deque
from queue import PriorityQueue
from math import *
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7
n = ii()
a = []
for i in range(n):
	(x, y) = il()
	a.append([x, y])
d = {}
for i in range(n):
	for j in range(i + 1, n):
		(x1, y1) = a[i]
		(x2, y2) = a[j]
		key = (x1 + x2, y1 + y2)
		d[key] = d.get(key, 0) + 1
ans = 0
for i in d:
	ans += d[i] * (d[i] - 1)
print(ans // 2)


from collections import Counter
n = int(input())
ls = []
for i in range(n):
	(a, b) = map(int, input().split())
	ls.append((a, b))
counter = Counter()
for i in range(n):
	for j in range(i + 1, n):
		medio = ((ls[i][0] + ls[j][0]) / 2, (ls[i][1] + ls[j][1]) / 2)
		counter[medio] += 1
sum = 0
for c in counter:
	if counter[c] > 1:
		sum += counter[c] * (counter[c] - 1) / 2
print(int(sum))


from collections import defaultdict as dd
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
	s = input().split()
	x[i] = int(s[0])
	y[i] = int(s[1])
cnt = dd(lambda : 0)
for i in range(N):
	for j in range(i):
		cnt[f'{x[i] + x[j]}-{y[i] + y[j]}'] += 1
total = 0
for value in cnt.values():
	total += value * (value - 1) / 2
print(int(total))


n = int(input())
p = []
d = dict()
for i in range(n):
	p.append(list(map(int, input().strip().split())))
for i in range(n):
	for j in range(i + 1, n):
		x = (p[i][0] + p[j][0]) / 2.0
		y = (p[i][1] + p[j][1]) / 2.0
		if (x, y) in d.keys():
			d[x, y] += 1
		else:
			d[x, y] = 1
c = 0
for k in d.keys():
	e = d[k]
	c += e * (e - 1) // 2
print(c)


n = int(input())
a = []
for _ in range(n):
	xy = list(map(int, input().split()))
	a.append(xy)
midpoint = {}
for i in range(n):
	for j in range(i + 1, n):
		(x1, y1) = (a[i][0], a[i][1])
		(x2, y2) = (a[j][0], a[j][1])
		dx = x2 + x1
		dy = y2 + y1
		midpoint[dx / 2, dy / 2] = midpoint.get((dx / 2, dy / 2), 0) + 1
ans = 0
for (k, v) in midpoint.items():
	ans += v * (v - 1) // 2
print(ans)


import sys, math, string, bisect
input = sys.stdin.readline
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
n = I()
d = defaultdict(int)
l = []
for i in range(n):
	p = L()
	l.append(p)
for i in range(n - 1):
	for j in range(i + 1, n):
		d[l[i][0] + l[j][0], l[i][1] + l[j][1]] += 1
ans = 0
for i in d.keys():
	ans += d[i] * (d[i] - 1) // 2
print(ans)


from collections import defaultdict
import math

def main():
	n = int(input())
	x = [None] * n
	y = [None] * n
	dictionary = defaultdict(int)
	total = 0
	for i in range(n):
		(x[i], y[i]) = map(int, input().split())
	for i in range(n):
		for j in range(i + 1, n):
			xdist = x[i] - x[j]
			ydist = y[i] - y[j]
			if xdist > 0:
				xdist *= -1
				ydist *= -1
			elif xdist == 0 and ydist > 0:
				xdist *= -1
				ydist *= -1
			dictionary[xdist, ydist] += 1
	for i in dictionary.values():
		total += math.floor(i * (i - 1) / 2)
	print(math.floor(total / 2))
main()


from collections import Counter
t = int(input())
if t < 4:
	print(0)
else:
	arr = []
	b = []
	for i in range(t):
		arr.append(list(map(int, input().split(' '))))
	for i in range(t - 1):
		for j in range(i + 1, t):
			b.append(str(arr[i][0] + arr[j][0]) + '+' + str(arr[i][1] + arr[j][1]))
	t = 0
	for n in Counter(b).values():
		t += n * (n - 1) // 2
	print(t)


from collections import defaultdict

def mp():
	return list(map(int, input().split()))

def lt():
	return list(map(int, input().split()))

def pt(x):
	print(x)

def ip():
	return input()

def it():
	return int(input())

def sl(x):
	return [t for t in x]

def spl(x):
	return x.split()

def aj(liste, item):
	liste.append(item)

def bin(x):
	return '{0:b}'.format(x)
n = it()
P = []
for i in range(n):
	(a, b) = mp()
	P.append([a, b])
Mid = defaultdict(int)
result = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		(x, y) = (P[i][0] + P[j][0], P[i][1] + P[j][1])
		result += Mid[x, y]
		Mid[x, y] += 1
print(result)


from functools import cmp_to_key
from collections import deque, Counter
from heapq import heappush, heappop
from math import log, ceil
import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def ii():
	return int(inp())

def si():
	return str(inp())

def li(lag=0):
	l = list(map(int, inp().split()))
	if lag != 0:
		for i in range(len(l)):
			l[i] += lag
	return l

def mi(lag=0):
	matrix = list()
	for i in range(n):
		matrix.append(li(lag))
	return matrix

def lsi():
	return list(map(str, inp().split()))

def print_list(lista, space=' '):
	print(space.join(map(str, lista)))

def bisect_left(a, x):
	left = 0
	right = len(a)
	while left < right:
		mid = (left + right) // 2
		if a[mid] < x:
			left = mid + 1
		else:
			right = mid
	return left

def bisect_right(a, x):
	left = 0
	right = len(a)
	while left < right:
		mid = (left + right) // 2
		if a[mid] > x:
			right = mid
		else:
			left = mid + 1
	return left

def bisect_elements(a, x):
	return bisect_right(a, x) - bisect_left(a, x)
MOD = 10 ** 9 + 7
maxN = 5
FACT = [0] * maxN
INV_FACT = [0] * maxN

def add(x, y):
	return (x + y) % MOD

def multiply(x, y):
	return x * y % MOD

def power(x, y):
	if y == 0:
		return 1
	elif y % 2:
		return multiply(x, power(x, y - 1))
	else:
		a = power(x, y // 2)
		return multiply(a, a)

def inverse(x):
	return power(x, MOD - 2)

def divide(x, y):
	return multiply(x, inverse(y))

def allFactorials():
	FACT[0] = 1
	for i in range(1, maxN):
		FACT[i] = multiply(i, FACT[i - 1])

def inverseFactorials():
	n = len(INV_FACT)
	INV_FACT[n - 1] = inverse(FACT[n - 1])
	for i in range(n - 2, -1, -1):
		INV_FACT[i] = multiply(INV_FACT[i + 1], i + 1)

def coeffBinom(n, k):
	if n < k:
		return 0
	return multiply(FACT[n], multiply(INV_FACT[k], INV_FACT[n - k]))

def create_graph(n, m, undirected=1, unweighted=1):
	graph = [[] for i in range(n)]
	if unweighted:
		for i in range(m):
			[x, y] = li(lag=-1)
			graph[x].append(y)
			if undirected:
				graph[y].append(x)
	else:
		for i in range(m):
			[x, y, w] = li(lag=-1)
			w += 1
			graph[x].append([y, w])
			if undirected:
				graph[y].append([x, w])
	return graph

def create_tree(n, unweighted=1):
	children = [[] for i in range(n)]
	if unweighted:
		for i in range(n - 1):
			[x, y] = li(lag=-1)
			children[x].append(y)
			children[y].append(x)
	else:
		for i in range(n - 1):
			[x, y, w] = li(lag=-1)
			w += 1
			children[x].append([y, w])
			children[y].append([x, w])
	return children

def dist(tree, n, A, B=-1):
	s = [[A, 0]]
	(massimo, massimo_nodo) = (0, 0)
	distanza = -1
	v = [-1] * n
	while s:
		(el, dis) = s.pop()
		if dis > massimo:
			massimo = dis
			massimo_nodo = el
		if el == B:
			distanza = dis
		for child in tree[el]:
			if v[child] == -1:
				v[child] = 1
				s.append([child, dis + 1])
	return (massimo, massimo_nodo, distanza)

def diameter(tree):
	(_, foglia, _) = dist(tree, n, 0)
	(diam, _, _) = dist(tree, n, foglia)
	return diam

def dfs(graph, n, A):
	v = [-1] * n
	s = [[A, 0]]
	v[A] = 0
	while s:
		(el, dis) = s.pop()
		for child in graph[el]:
			if v[child] == -1:
				v[child] = dis + 1
				s.append([child, dis + 1])
	return v

def bfs(graph, n, A):
	v = [-1] * n
	s = deque()
	s.append([A, 0])
	v[A] = 0
	while s:
		(el, dis) = s.popleft()
		for child in graph[el]:
			if v[child] == -1:
				v[child] = dis + 1
				s.append([child, dis + 1])
	return v

def parents_children_root_unrooted_tree(tree, n, root=0):
	q = deque()
	visited = [0] * n
	parent = [-1] * n
	children = [[] for i in range(n)]
	q.append(root)
	while q:
		all_done = 1
		visited[q[0]] = 1
		for child in tree[q[0]]:
			if not visited[child]:
				all_done = 0
				q.appendleft(child)
		if all_done:
			for child in tree[q[0]]:
				if parent[child] == -1:
					parent[q[0]] = child
					children[child].append(q[0])
			q.popleft()
	return (parent, children)

def all_longest_path_passing_from_node(parent, children, n):
	q = deque()
	visited = [len(children[i]) for i in range(n)]
	downwards = [[0, 0] for i in range(n)]
	upward = [1] * n
	longest_path = [1] * n
	for i in range(n):
		if not visited[i]:
			q.append(i)
			downwards[i] = [1, 0]
	while q:
		node = q.popleft()
		if parent[node] != -1:
			visited[parent[node]] -= 1
			if not visited[parent[node]]:
				q.append(parent[node])
		else:
			root = node
		for child in children[node]:
			downwards[node] = sorted([downwards[node][0], downwards[node][1], downwards[child][0] + 1], reverse=True)[0:2]
	s = [node]
	while s:
		node = s.pop()
		if parent[node] != -1:
			if downwards[parent[node]][0] == downwards[node][0] + 1:
				upward[node] = 1 + max(upward[parent[node]], downwards[parent[node]][1])
			else:
				upward[node] = 1 + max(upward[parent[node]], downwards[parent[node]][0])
		longest_path[node] = downwards[node][0] + downwards[node][1] + upward[node] - min([downwards[node][0], downwards[node][1], upward[node]]) - 1
		for child in children[node]:
			s.append(child)
	return longest_path
n = ii()
d = dict()
a = list()
for i in range(n):
	(x, y) = li()
	a.append([x, y])
for i in range(n - 1):
	for j in range(i + 1, n):
		(xi, yi) = a[i]
		(xj, yj) = a[j]
		punto = 2 * 10 ** 9 * (xi + xj) + (yi + yj)
		d[punto] = d.get(punto, 0) + 1
res = 0
for x in d:
	res += d[x] * (d[x] - 1) // 2
print(res)


from collections import *
ans = 0
d = Counter()
n = int(input())
p = [tuple(map(int, input().split())) for i in range(n)]
for i in range(n):
	for j in range(i + 1, n):
		if p[i] < p[j]:
			(x1, y1) = p[i]
			(x2, y2) = p[j]
		else:
			(x1, y1) = p[j]
			(x2, y2) = p[i]
		(x, y) = (x2 - x1, y2 - y1)
		ans += d[x, y]
		d[x, y] += 1
print(ans // 2)