N=int(input())
array=list(map(int,input().split()))

X=[0]
for i in array:
    X.append(i)

INF=10000000

dp=[[INF for j in range(100+1)] for j in range(N+1)]

for i in range(100+1):
    dp[0][i]=0

for i in range(1,N+1):
    for j in range(1,100+1):
        dp[i][j]=min(dp[i][j],dp[i-1][j]+(X[i]-j)**2)
        
ans=INF
for i in range(1,100+1):
    ans=min(ans,dp[N][i])

print(ans) N=int(input()) N int(input()) int input() input array=list(map(int,input().split())) array list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split X=[0] X [0] 0 for i in array:
    X.append(i) i array X.append(i) X.append X append i INF=10000000 INF 10000000 [INF for j in range(100+1)] for j in range(N+1) for j in range(N+1) j range(N+1) range N+1 N 1 for j in range(N+1) [INF for j in range(100+1)] dp=[[INF for j in range(100+1)] for j in range(N+1)] dp [[INF for j in range(100+1)] for j in range(N+1)] for i in range(100+1):
    dp[0][i]=0 i range(100+1) range 100+1 100 1 dp[0][i]=0 dp[0][i] [0] dp 0 i 0 for i in range(1,N+1):
    for j in range(1,100+1):
        dp[i][j]=min(dp[i][j],dp[i-1][j]+(X[i]-j)**2)
         i range(1,N+1) range 1 N+1 N 1 for j in range(1,100+1):
        dp[i][j]=min(dp[i][j],dp[i-1][j]+(X[i]-j)**2)
         j range(1,100+1) range 1 100+1 100 1 dp[i][j]=min(dp[i][j],dp[i-1][j]+(X[i]-j)**2) dp[i][j] [i] dp i j min(dp[i][j],dp[i-1][j]+(X[i]-j)**2) min dp[i][j] [i] dp i j dp[i-1][j]+(X[i]-j)**2 dp[i-1][j] [i-1] dp i-1 i 1 j (X[i]-j)**2 X[i]-j X[i] X i j 2 ans=INF ans INF for i in range(1,100+1):
    ans=min(ans,dp[N][i]) i range(1,100+1) range 1 100+1 100 1 ans=min(ans,dp[N][i]) ans min(ans,dp[N][i]) min ans dp[N][i] [N] dp N i print(ans) print ans dp=[[INF for j in range(100+1)] for j in range(N+1)] [[INF for j in range(100+1)] for j in range(N+1)] dp ans=min(ans,dp[N][i]) min(ans,dp[N][i]) ans N=int(input()) int(input()) N INF=10000000 10000000 INF array=list(map(int,input().split())) list(map(int,input().split())) array X=[0] [0] X ans=INF INF ans
N=int(input())
array=list(map(int,input().split()))

X=[0]
for i in array:
    X.append(i)

INF=10000000

dp=[[INF for j in range(100+1)] for j in range(N+1)]

for i in range(100+1):
    dp[0][i]=0

for i in range(1,N+1):
    for j in range(1,100+1):
        dp[i][j]=min(dp[i][j],dp[i-1][j]+(X[i]-j)**2)
        
ans=INF
for i in range(1,100+1):
    ans=min(ans,dp[N][i])

print(ans)