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