#include<iostream>
using namespace std;
int main(){
int n, a[1005], cont=0;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n - 1; i++){
for (int j = i + 1; j < n; j++){
if ((a[i] + a[j]) % n == 0)
cont++;
}
}
cout << cont;
return 0;
}