#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const long long MOD = 1000000007;
const i64 INF = i64(1e18) + 7;
template <typename T>
bool chmin(T& x, T y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}
template <typename T>
bool chmax(T& x, T y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}
template <i64 mod = MOD>
struct ModInt {
  i64 p;
  ModInt() : p(0) {}
  ModInt(i64 x) { p = x >= 0 ? x % mod : x + (-x + mod - 1) / mod * mod; }
  ModInt& operator+=(const ModInt& y) {
    p = p + *y - ((p + *y) >= mod ? mod : 0);
    return *this;
  }
  ModInt& operator-=(const ModInt& y) {
    p = p - *y + (p - *y < 0 ? mod : 0);
    return *this;
  }
  ModInt& operator*=(const ModInt& y) {
    p = (p * *y) % mod;
    return *this;
  }
  ModInt& operator%=(const ModInt& y) {
    if (y) p %= *y;
    return *this;
  }
  ModInt operator+(const ModInt& y) const {
    ModInt x = *this;
    return x += y;
  }
  ModInt operator-(const ModInt& y) const {
    ModInt x = *this;
    return x -= y;
  }
  ModInt operator*(const ModInt& y) const {
    ModInt x = *this;
    return x *= y;
  }
  ModInt operator%(const ModInt& y) const {
    ModInt x = *this;
    return x %= y;
  }
  friend ostream& operator<<(ostream& stream, const ModInt<mod>& x) {
    stream << *x;
    return stream;
  }
  friend ostream& operator>>(ostream& stream, const ModInt<mod>& x) {
    stream >> *x;
    return stream;
  }
  ModInt& operator++() {
    p = (p + 1) % mod;
    return *this;
  }
  ModInt& operator--() {
    p = (p - 1 + mod) % mod;
    return *this;
  }
  bool operator==(const ModInt& y) const { return p == *y; }
  bool operator!=(const ModInt& y) const { return p != *y; }
  const i64& operator*() const { return p; }
  i64& operator*() { return p; }
};
using mint = ModInt<>;
template <typename T>
struct DisjointSparseTable {
  function<T(T, T)> f;
  vector<vector<T>> v;
  DisjointSparseTable(vector<T>& inp, function<T(T, T)> f) : f(f) {
    int n = inp.size();
    int b;
    for (b = 0; (1 << b) <= inp.size(); ++b)
      ;
    v.assign(b, vector<T>(n));
    for (int i = 0; i < n; ++i) v[0][i] = inp[i];
    for (int i = 1; i < b; ++i) {
      int siz = 1 << i;
      for (int j = 0; j < n; j += siz << 1) {
        int t = min(j + siz, n);
        v[i][t - 1] = inp[t - 1];
        for (int k = t - 2; k >= j; --k) v[i][k] = f(inp[k], v[i][k + 1]);
        if (t >= n) break;
        v[i][t] = inp[t];
        int r = min(t + siz, n);
        for (int k = t + 1; k < r; ++k) v[i][k] = f(v[i][k - 1], inp[k]);
      }
    }
  }
  T get(int l, int r) {
    if (l >= --r) return v[0][l];
    int p = 31 - __builtin_clz(l ^ r);
    return f(v[p][l], v[p][r]);
  }
};
void solve(long long n, std::vector<long long> x) {
  int cnt = 0;
  int m = n - 1;
  for (int j = 0; j < n; ++j) {
    if (1 == j + 1) continue;
    for (int i = 0; i < j; ++i) {
      ++cnt;
    }
  }
  cout << cnt << endl;
}
signed main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> x(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &x[i]);
  }
  solve(N, std::move(x));
  return 0;
}
