#include <bits/stdc++.h>
int cmp(const void* a, const void* b) { return *(int*)a - *(int*)b; }
int main(void) {
  int n;
  int s[100005];
  long long int sum = 0;
  long long int sum1 = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &s[i]);
  }
  qsort(s, n, sizeof(int), cmp);
  for (int i = 0; i < n / 2; i++) {
    sum += s[i];
  }
  for (int i = n / 2; i < n; i++) {
    sum1 += s[i];
  }
  printf("%lld\n", sum * sum + sum1 * sum1);
}
