#include <bits/stdc++.h>
const double PI = 3.141592653589793238460;
using namespace std;
long long int ar[100001];
int main() {
  long long int n, tot = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> ar[i], tot += ar[i];
  sort(ar + 1, ar + n + 1);
  long long int a = 0, b = 0;
  for (int i = 1; i <= n / 2; i++) a += ar[i];
  tot -= a;
  cout << (a * a + tot * tot);
}
