#include <bits/stdc++.h>
using namespace std;
int n;
int a[100001];
long long sum1, sum2;
int cmp(int x, int y) { return x < y; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum2 += a[i];
  }
  sort(a + 1, a + 1 + n, cmp);
  int m = n >> 1;
  for (int i = 1; i <= m; i++) sum1 += a[i];
  sum2 -= sum1;
  cout << sum1 * sum1 + sum2 * sum2 << endl;
  return 0;
}
