#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int arr[100005];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  int vertical = 0, horizontal = 0;
  for (int i = 0; i < n / 2; i++) {
    vertical += arr[i];
  }
  for (int i = n / 2; i < n; i++) {
    horizontal += arr[i];
  }
  long long int ans = pow(vertical, 2) + pow(horizontal, 2);
  cout << ans << endl;
}
