#include <bits/stdc++.h>
using namespace std;
int rd() {
  char c = getchar();
  int s = 0, f = 1;
  while (c > '9' || c < '0') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    s = (s << 1) + (s << 3) + (c ^ 48), c = getchar();
  return s * f;
}
const int N = 100005;
int a[N], n, x, y;
bool cmp(int i, int j) { return i < j; }
int main() {
  n = rd();
  for (int i = 1; i <= n; i++) a[i] = rd();
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n / 2; i++) x += a[i];
  for (int i = n / 2 + 1; i <= n; i++) y += a[i];
  printf("%I64d\n", 1ll * x * x + 1ll * y * y);
}
