#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
const int mo = 1e9 + 7;
long long arr[100005];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  long long sum1 = 0, sum2 = 0;
  for (int i = 0; i < n / 2; i++) sum1 += arr[i];
  for (int i = n / 2; i < n; i++) sum2 += arr[i];
  cout << sum1 * sum1 + sum2 * sum2 << endl;
  return 0;
}
