#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
//#include <windows.h>

#define ll long long

typedef struct{
	int x, y;
} point_t;

point_t* point_init(int x, int y){
	point_t* result = (point_t*) malloc(sizeof(point_t));
	result->x = x;
	result->y = y;
	return result;
}

ll computed_x[20000] = {0};
ll computed_y[20000] = {0};

/*
ll compute(point_t* p1, point_t* p2){
	ll x_diff = p1->x > p2->x ? p1->x - p2->x : p2->x - p1->x;
	if(computed_x[x_diff] == 0) computed_x[x_diff] = x_diff * x_diff;
	ll y_diff = p1->y > p2->y ? p1->y - p2->y : p2->y - p1->y;
	if(computed_y[y_diff] == 0) computed_y[y_diff] = y_diff * y_diff;
	return computed_x[x_diff] + computed_y[y_diff];
}
*/

ll compute(ll x1, ll y1, ll x2, ll y2){
	ll x_diff = x1 > x2? x1 - x2 : x2 - x1;
	if(computed_x[x_diff] == 0) computed_x[x_diff] = x_diff * x_diff;
	ll y_diff = y1 > y2? y1 - y2 : y2 - y1;
	if(computed_y[y_diff] == 0) computed_y[y_diff] = y_diff * y_diff;
	return computed_x[x_diff] + computed_y[y_diff];
}

int main(){
	int N;
	scanf("%d", &N);
	ll result = 0;
	//point_t* points[N];
	ll points[N][2];
	for(int i = 0; i < N; i++){
		int x, y;
		scanf("%d %d", &x, &y);
		//points[i] = point_init(x, y);
		points[i][0] = x;
		points[i][1] = y;
	}
	for(int i = 0; i < N; i++){
		for(int j = i + 1; j < N; j++){
			//result += compute(points[i], points[j]);
			result += compute(points[i][0], points[i][1], points[j][0], points[j][1]);
			//printf("point %d to %d = %d\n", i, j, compute(points[i], points[j]));
		}
	}
	printf("%lld", result);
	//system("pause");
	return 0;
}
