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