#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

template <typename T, typename F>
T binarySearch(T ok, T ng, F isOK, T bound = 1) {
    while (abs(ng - ok) > bound) {
        T m = (ng + ok) / 2;
        if (isOK(m))
            ok = m;
        else
            ng = m;
    }
    return ok;
}

void solve() {
    int N;
    cin >> N;
    // 等差数列の和　S = n(a + l) / 2
    auto fn = [&](int m) { return (m * (m + 1) / 2 <= N + 1); };
    cout << N - binarySearch(0LL, (int)2e9, fn) + 1 << endl;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

const int MA = 200;

int main(void){
  int n; cin >> n;
  vector<ll> a(2*MA+1,0);
  rep(i,n){
    int tmp; cin >> tmp;
    a[MA+tmp]++;
  }	      

  ll ans = 0;
  for(int i = 0;i < 2*MA+1;i++){
    for(int j = 0;j < 2*MA+1;j++){
      ans += a[i]*a[j]*(i-j)*(i-j);
    }  
  }
  ans /= 2;
  
  cout << ans << endl;
  
  return 0;
}
