#include <iostream>
#include <vector>
#include <cmath>
#include <complex>
using namespace std;
typedef long long ll;
const ll P = 200'003;

typedef long double ld;
typedef complex<ld> co;
const ld PI=atan2((ld)0, (ld)-1);
void fft(vector<co>&a, int n, int k) {
	vector<co> ww(n);
	ww[1]=co(1, 0);
	for (int t=0;t<k-1;t++) {
		co c=polar((ld)1, PI/n*(1<<(k-1-t)));
		int p2=(1<<t),p3=p2*2;
		for (int j=p2;j<p3;j++) ww[j*2+1]=(ww[j*2]=ww[j])*c;
	}
	for (int i=0;i<n;i++) {
		int u=0;
		for (int j=1;j<n;j*=2) {u*=2;if (i&j) u++;}
		if (i<u) swap(a[i], a[u]);
	}
	for (int l=1;l<n;l*=2) {
		for (int i=0;i<n;i+=l) {
			for (int it=0,j=i+l,w=l;it<l;it++,i++,j++) {
				co t=a[j]*ww[w++];
				a[j]=a[i]-t;
				a[i]=a[i]+t;
			}
		}
	}
}
vector<ll> conv(const vector<ll>& a, const vector<ll>& b) {
	int as=a.size(), bs=b.size();
	if (as*bs==0) return {};
	int k=0;
	while ((1<<k)<as+bs-1) k++;
	int n=1<<k;
	vector<co> c(n+1);
	for (int i=0;i<n;i++) {
		if (i<as) c[i]=a[i];
		if (i<bs) c[i]={c[i].real(), (ld)b[i]};
	}
	fft(c, n, k);
	c[n]=c[0];
	for (int i=0;i<=n-i;i++) {
		c[i]=conj(c[i]*c[i]-conj(c[n-i]*c[n-i]))*co(0,(ld)1/n/4);
		c[n-i]=conj(c[i]);
	}
	fft(c, n, k);
	vector<ll> r(as+bs-1);
	for (int i=0;i<as+bs-1;i++) r[i]=round(c[i].real());
	return r;
}
int main() {
  // find a primitive root mod P
  ll pr = -1;
  for(int i = 2; pr == -1; ++i) {
    // test if i is a primitive root mod P
    int ok = 1;
    ll i_to_power = 1;
    for(int j = 1; j+2 <= P; ++j) {
      i_to_power = i_to_power * i % P;

      if(i_to_power == 1) {
        ok = 0;
        break;
      }
    }
    if(ok) {
      pr = i;
    }
  }

  // the idea is to go through every possible product q = a_i * a_j
  // and then count how many i, j satisfy this.
  //
  // let's first allow i > j and i < j and i == j.
  // in the end we can just remove i == j
  //
  // every number x \in 1..(p-1) can be represented as pr^ind(x) = x
  // q = a_i * a_j <==> pr^ind(q) = pr^ind(a_i) * pr^ind(a_j)
  // <==> pr^ind(q) = pr^(ind(a_i) + ind(a_j))
  // <==> ind(q) = ind(a_i) + ind(a_j)
  //
  // so we can just loop through all values of x and then
  // find the number of indices i and j that satisfy
  // x = ind(a_i) + ind(a_j)
  // how to do this?
  // if we fix ind(a_i) = c, then our equality will only be satisfied
  // by a_j for which holds ind(a_j) = x - c
  // the total number of suitable pairs for which ind(a_i) = c
  // can then be calculated:
  // cnt(ind(a_i) = c) * (cnt(ind(a_j)) = x - c)
  // where cnt(z) is the number of indices satisfying the expression z
  // 
  // let's just precalculate these into an array cnt_ind
  // and convolution...

  ll ind[P] = {0};
  ll pr_to_power[3*P];
  pr_to_power[0] = 1;
  for(int i = 1; i < 3*P; ++i) {
    pr_to_power[i] = pr_to_power[i-1]*pr%P;
  }
  // pr ^ (P-1) = 1
  for(int i = 0; i < P-1; ++i) {
    ind[pr_to_power[i]] = i;
  }

  int n;
  cin>>n;
  vector<ll> ind_cnts(P);
  ll ans = 0;
  for(int i = 0; i < n; ++i) {
    ll a;
    cin>>a;
    if(a != 0) {
      ++ind_cnts[ind[a]];
    }
    // remove i == j
    ans -= a*a%P;
  }
  vector<ll> c = conv(ind_cnts, ind_cnts);
  // c[i] = the number of pairs j, k for which holds ind(a_j) + ind(a_k) = i
  for(int i = 0; i < c.size(); ++i) {
    ans += pr_to_power[i] * c[i];
  } 
  // only i < j
  ans /= 2;
  cout<<ans<<endl;
}


Measured memory_bytes: 44380