#include <bits/stdc++.h>
using namespace std;
inline int ci() {
  register char ch;
  int f = 1;
  while (!isdigit(ch = getchar())) f = ch == '-' ? -1 : 1;
  register int x = ch ^ '0';
  while (isdigit(ch = getchar())) x = (x * 10) + (ch ^ '0');
  return f * x;
}
enum { N = 100024 };
int a[N];
int main() {
  int n = ci();
  for (register int i = (1); i <= (n); i++) a[i] = ci();
  sort(a + 1, a + n + 1);
  long long a1 = 0, a2 = 0;
  int m = n / 2;
  for (register int i = (1); i <= (m); i++) a1 += a[i];
  for (register int i = (m + 1); i <= (n); i++) a2 += a[i];
  printf("%I64d", a1 * a1 + a2 * a2);
  return 0;
}
