import sys

N = next(sys.stdin.buffer)
X = tuple(map(int, next(sys.stdin.buffer).split()))

min_x = min(X)
max_x = max(X)

stamina = min(sum((p - x) ** 2 for x in X) for p in range(min_x, max_x + 1))

print(stamina) import sys sys N = next(sys.stdin.buffer) N next(sys.stdin.buffer) next sys.stdin.buffer sys.stdin sys stdin buffer X = tuple(map(int, next(sys.stdin.buffer).split())) X tuple(map(int, next(sys.stdin.buffer).split())) tuple map(int, next(sys.stdin.buffer).split()) map int next(sys.stdin.buffer).split() (sys.stdin.buffer).split (sys.stdin.buffer) next sys.stdin.buffer sys.stdin sys stdin buffer split min_x = min(X) min_x min(X) min X max_x = max(X) max_x max(X) max X stamina = min(sum((p - x) ** 2 for x in X) for p in range(min_x, max_x + 1)) stamina min(sum((p - x) ** 2 for x in X) for p in range(min_x, max_x + 1)) min sum((p - x) ** 2 for x in X) sum (p - x) ** 2 p - x p x 2 print(stamina) print stamina max_x = max(X) max(X) max_x min_x = min(X) min(X) min_x stamina = min(sum((p - x) ** 2 for x in X) for p in range(min_x, max_x + 1)) min(sum((p - x) ** 2 for x in X) for p in range(min_x, max_x + 1)) stamina X = tuple(map(int, next(sys.stdin.buffer).split())) tuple(map(int, next(sys.stdin.buffer).split())) X N = next(sys.stdin.buffer) next(sys.stdin.buffer) N
import sys

N = next(sys.stdin.buffer)
X = tuple(map(int, next(sys.stdin.buffer).split()))

min_x = min(X)
max_x = max(X)

stamina = min(sum((p - x) ** 2 for x in X) for p in range(min_x, max_x + 1))

print(stamina)
