#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1
#define j0 gray_cat_j0

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll LL_INF = 1e17 + 16;
const int INF = 1e9 + 10;
const ll MOD = 200003;

const ll ROOT = 2;

int ind[MOD];
ll val[MOD];
int cnt[MOD];

const int MAXN = 1 << 19;

int rev[MAXN];
point wlen_pw[MAXN], a[MAXN], b[MAXN], fa[MAXN], fb[MAXN];
ll res[MAXN];

void calc_rev(int n, int log_n){
	for (int i = 1; i < n; i++){
		rev[i] = rev[i - 1];
		int j;
		for(j = log_n - 1; rev[i] & (1 << j); j--){
			rev[i] ^= (1 << j);		
		}
		rev[i] ^= (1 << j);
	}
}

void fft(point *a, int n, bool invert){
	for (int i = 0; i < n; i++){
		if (i < rev[i]){
			swap(a[i], a[rev[i]]);
		}
	}
 
	for(int len = 2; len <= n; len <<= 1){
		double ang = 2. * PI / len * (invert? -1: 1);
		int len2 = len >> 1;
 
		point wlen(cos(ang), sin(ang));
		wlen_pw[0] = point(1., 0.);
		for(int i = 1; i < len2; i++){
			wlen_pw[i] = wlen_pw[i - 1] * wlen;
 		}

		for(int i = 0; i < n; i += len){
			point t,
				*pu = a + i,
				*pv = a + i + len2, 
				*pu_end = a + i + len2,
				*pw = wlen_pw;
			for(; pu != pu_end; pu++, pv++, pw++){
				t = *pv * *pw;
				*pv = *pu - t;
				*pu += t;
			}
		}
	}
 
	if (invert){
		for (int i = 0; i < n; i++){
			a[i] /= n;
		}
	}
}

void mul(int n, point *a, point *b, point *fa, point *fb, ll *res){
	for(int i = 0; i < n; i++){
		fa[i] = a[i];
		fb[i] = b[i];	
	}
	int n1 = 1, log_n1 = 0;
	while (n1 < n){
		n1 <<= 1;
		log_n1++;
	}
	n1 <<= 1;
	log_n1++;

	calc_rev(n1, log_n1);

	fft (fa, n1, false);
	fft (fb, n1, false);
	for (int i = 0; i < n1; i++){
		fa[i] *= fb[i];
	}
	fft(fa, n1, true);
 
	for (int i = 0; i < n1; i++){
		res[i] = ll(fa[i].xx + 0.5);
	}
}


void solve(){
	/*for(ll v = 2; v < 100; v++) {
		ll a = 1;
		int fl = 0;
		for(int i = 0; ; i++) {
			a = (a * v) % MOD;
			if (a == 1) {
				fl = i;
				break;
			}
		}
		printf("%lld %d\n", v, fl);
	}
	Found 2!!!
	*/
	ll c = 1;
	ind[1] = 0;
	val[0] = 1;
	for(int i = 1; ; i++) {
		c = (c * ROOT) % MOD;
		if (c == 1) {
			break;
		}
		ind[c] = i;
		val[i] = c;
	}
	/*REP(i, 1, 100) {
		printf("%d: %d\n", i, ind[i], val[i]);
	}*/
	
	int n;
	scanf("%d", &n);
	REP(i, 0, n) {
		int v;
		scanf("%d", &v);
		if (v) {
			cnt[ind[v]]++;
		}
	}
	REP(i, 0, MOD) {
		b[i] = a[i] = point(cnt[i], 0.);
	}
	mul(MOD, a, b, fa, fb, res);
	
	ll ans = 0ll;
	REP(i, 0, MAXN) {
		/*if (res[i]) {
			printf("%d: %lld\n", i, res[i]);
		}*/
		ans += val[i % (MOD - 1)] * res[i];
	}
	REP(i, 0, MOD) {
		ans -= cnt[i] * ((val[i] * val[i]) % MOD);
	}
	ans /= 2;
	cout << ans << endl;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 40040