#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, a[maxn];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = 0, sum = 0;
  map<int, int> count;
  for (int i = 0; i < n; i++) {
    sum += a[i];
    ans += count[a[i]];
    count[a[i]] += 1;
  }
  cout << ans << endl;
}
