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

#define ll long long

bool sortiraj(const pair<int, int> &a, const pair<int, int> &b)
{
	return a.second > b.second;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;
	vector<pair<int, int>> tacke(n);
	for (int i = 0; i < n; i++) {
		cin >> tacke[i].first >> tacke[i].second;
	}
	int ans = 0;
	// trazimo po x osi - sortiramo po first
	sort(tacke.begin(), tacke.end());
	for (int i = 0; i < n - 1; i++) {
		if (tacke[i].first != tacke[i + 1].first)
			continue;
		// tacke i, i+1 su paralelne po x osi
		int a = abs(tacke[i].first - tacke[i + 1].first);
		for (int j = i + 2; j < n - 1; j++) {
			if (tacke[j].first != tacke[j + 1].first)
				continue;
			int b = abs(tacke[j].first - tacke[j + 1].first);
			if (a == 2*b || 2*b == a) {
				++ans;
			}
		}
	}
	// trazimo po y osi - sortiramo po second
	sort(tacke.begin(), tacke.end(), sortiraj);
	for (int i = 0; i < n - 1; i++) {
		if (tacke[i].second != tacke[i + 1].second)
			continue;
		// tacke i, i+1 su paralelne po y osi
		int a = abs(tacke[i].second - tacke[i + 1].second);
		for (int j = i + 2; j < n - 1; j++) {
			if (tacke[j].second != tacke[j + 1].second)
				continue;
			int b = abs(tacke[j].second - tacke[j + 1].second);
			if (a == 2*b || 2*b == a) {
				++ans;
			}
		}
	}

	// sada trazimo po dijagonalama
	map<pair<int, int>, int> mp;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			int a = (tacke[i].first - tacke[j].first);
			int b = (tacke[i].second - tacke[j].second);

			if (a == 0 || b == 0)
				continue;

			 // cout << "dodajemo par: " << a << " " << b << "\n";
			mp[make_pair(a, b)]++;
		}
	}

	for (auto it : mp) {
		int x = it.first.first;
		int y = it.first.second;

		if(mp.find({2*x, 2*y}) != mp.end()) {
			// cout << "za par " << x << " " << y << " : " << it.second << "\n";
			// cout << "smo nasli " << 2*x << " " << 2*y << " koji se pojavljuje " <<  mp[make_pair(2*x, 2*y)] << "\n";
			ans += it.second * mp[make_pair(2*x, 2*y)];
		}
	}

	cout << ans << "\n";
	return 0;
}