#include <bits/stdc++.h>
using namespace std;
long long a[100005];
long long n, tmp1, tmp2, ans;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n / 2; i++) tmp1 += a[i];
  for (int i = n / 2 + 1; i <= n; i++) tmp2 += a[i];
  ans = tmp1 * tmp1 + tmp2 * tmp2;
  cout << ans;
}
