#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll a, b, c, i, j, k, l, m, n, ans, tmp, hoge, fuga, piyo;
ll x[200100], y[200100];
string s, str;
int main() {
  cin >> n;
  for (ll i = 0; i < n; i++) {
    cin >> x[i];
    a += x[i] * x[i];
    b += i * i;
  }
  cout << floor(pow((a * b), 0.5));
  return 0;
}
