#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, sum2 = 0;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    sum2 = sum2 + a[i];
  }
  sort(a, a + n);
  long long sum = 0, y, x;
  for (i = n - 1; i >= n / 2; i--) {
    sum = sum + a[i];
  }
  y = (sum2 - sum) * (sum2 - sum);
  x = sum * sum;
  cout << x + y;
}
