#include <bits/stdc++.h>
using namespace std;
int n, a[100005];
long long sum, s;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  sort(a, a + n);
  for (int i = 0; i <= (n - 2) / 2; i++) {
    s += a[i];
  }
  sum = sum - s;
  printf("%lld\n", s * s + sum * sum);
  return 0;
}
