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

int main() {
    int n;
    cin >> n;
    vector<ll> c(200);
    rep(i, n){
        ll a;
        cin >> a;
        c[a % 200]++;
    }
    ll ans = 0;
    for(int i = 0; i < 200; i++){
        ans += c[i] * (c[i] - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}
#include <iostream>

using namespace std;

struct fg {
	int f;
	int g;
};

fg func(int n) {
	fg r = { 0, 0 };
	if (n == 0) return r;
	while (n % 3 == 0) {
		r.f++;
		n /= 3;
	}
	r.g = n % 3;

	return r;
}

int main()
{
	bool frag = true;
	int n;
	string c;
	cin >> n >> c;

	int bf = 0;
	fg cfg = { 0, 1 };
	fg bffgu = { 0, 0 }, bffgd = { 0, 0 };
	for (int i = 0; i < n; i++) {
		if (cfg.f == 0) {
			switch (c[i])
			{
			case 'B':
				break;
			case 'W':
				bf += cfg.g;
				break;
			case 'R':
				bf += 2 * cfg.g;
				break;
			}
		}

		bffgd = func(i + 1);
		bffgu = func(n - i - 1); 

		cfg.f = cfg.f + bffgu.f - bffgd.f;
		cfg.g = (cfg.g * bffgu.g) % 3;
		if (cfg.g == bffgd.g) cfg.g = 1;
		else cfg.g = 2;

		bf = bf % 3;
	}


	if (n % 2) {
		switch (bf)
		{
		case 0 :
			cout << "B";
			break;
		case 1 :
			cout << "W";
			break;
		case 2:
			cout << "R";
			break;
		}
	}
	else {
		switch (bf)
		{
		case 0:
			cout << "B";
			break;
		case 1:
			cout << "R";
			break;
		case 2:
			cout << "W";
			break;
		}
	}

	return 0;
}