#include<bits/stdc++.h>
#define ll long long int
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector< pii >
#define vpll vector< pll >
#define mpii map<int,int>
#define mpll map<ll,ll>
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define s(v) v.size()
#define test ll t;cin>>t;while(t--)
#define vec vector<ll>
#define read0(v,n) for(int i=0;i<n;i++)cin>>v[i];
#define read1(v,n) for(int i=1;i<=n;i++)cin>>v[i];
#define trav(a,x) for (auto& a: x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define cut(x) {cout<<x;return 0;}
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORB(i,a,b) for(int i=a;i>=b;i--)

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define f first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define nl '\n'
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
#define oset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
ll gcd(ll a, ll b)
{
	if (b==0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}
ll pow(ll a, ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%MOD;
		b/=2;
		a=(a*a)%MOD;
	}
	return ans;
}
ll dp[1000006];
int main()
{
	fast
	ll ans=0;
	dp[1]=1;
	FOR(i,1,1000002)
	{
	    dp[i]=dp[i-1]+i;
	}
	test
	{
	    ll a,b;
	    cin>>a>>b;
	    ans+=dp[b]-dp[a-1];
	}
	cout<<ans<<nl;
}

#include <iostream>

const int LAW = 200;
long long int count[LAW];

int main() {
    for (int i=0; i<LAW; ++i) {
        count[i] = 0;
    }

    long long int N, n;
    std::cin >> N;
    for (long long int i=0; i<N; ++i) {
        std::cin >> n;
        n %= LAW;
        count[n]++;
    }

    long long int answer = 0;
    for (auto c : count) {
        if (c <= 1) continue;
        answer += c * (c - 1) / 2;
    }

    std::cout << answer << std::endl;
}
