#pragma GCC optimize("O3")
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 200003
#define f(i,n) for(int i=0;i<int(n);i++)
#define N (19)
#define PI 3.1415926535898

long double b[(1 << N)];
long double re[(1 << N)][3];
long double im[(1 << N)][3];
long double cp[(1 << N)];
long double sp[(1 << N)];
long long ans[(1 << N)];


//初期化

void init(void) {
	f(i, (1 << N)) {
		f(j, 3) {
			re[i][j] = 0;
			im[i][j] = 0;
		}
		cp[i] = 0;
		sp[i] = 0;
	}
	return;
}



int main(void) {
	long long zz;
	long long bb[MOD];
	long long xx = 2;
	long long yy = 1;
	int n;
	int k2, bk2;
	long double k, bk, x, y, z;
	long long aa[MOD];
	long long fians = 0;;
	f(i, MOD)aa[i] = 0;
	f(i, MOD - 1) {
		bb[yy] = i;
		yy = (yy*xx) % MOD;
	}
	scanf("%d", &n);
	f(i, n) {
		scanf("%d", &xx);
		if(xx!=0)aa[bb[xx]]++;
		zz = (xx*xx) % MOD;
		fians -= zz;
	}
	init();
	f(i, MOD) {
		x = (long double)aa[i];
		b[i] = (long double)aa[i];
		k2 = i;
		bk2 = 0;
		f(i, N) {
			if (k2 % 2 == 1)bk2 += (1 << (N - i - 1));
			k2 = k2 / 2;
		}
		re[bk2][0] = x;
	}
	f(i, N) {
		k = 1;
		bk = 1;
		k2 = 1;
		bk2 = 1;
		f(j, i + 1) {
			k = k * 2;
			k2 = k2 * 2;
		}
		f(j, N - i - 1) {
			bk = bk * 2;
			bk2 = bk2 * 2;
		}
		x = 0;
		f(j, k2) {
			cp[j] = cos(x);
			sp[j] = sin(x);
			x += (PI * 2) / k;
		}
		k = k / 2;
		k2 = k2 / 2;
		f(ii, bk2) {
			f(j, k2) {
				re[(ii*k2 * 2) + j][2] = re[(ii*k2 * 2) + j][0] + (re[(ii*k2 * 2) + k2 + j][0] * cp[j]) - (im[(ii*k2 * 2) + k2 + j][0] * sp[j]);
				im[(ii*k2 * 2) + j][2] = im[(ii*k2 * 2) + j][0] + (re[(ii*k2 * 2) + k2 + j][0] * sp[j]) + (im[(ii*k2 * 2) + k2 + j][0] * cp[j]);
				re[(ii*k2 * 2) + k2 + j][2] = re[(ii*k2 * 2) + j][0] + (re[(ii*k2 * 2) + k2 + j][0] * cp[k2 + j]) - (im[(ii*k2 * 2) + k2 + j][0] * sp[k2 + j]);
				im[(ii*k2 * 2) + k2 + j][2] = im[(ii*k2 * 2) + j][0] + (re[(ii*k2 * 2) + k2 + j][0] * sp[k2 + j]) + (im[(ii*k2 * 2) + k2 + j][0] * cp[k2 + j]);
			}
		}
		f(j, (1 << N)) {
			re[j][0] = re[j][2];
			im[j][0] = im[j][2];
		}
	}
	f(i, MOD) {
		k2 = i;
		bk2 = 0;
		f(i, N) {
			if (k2 % 2 == 1)bk2 += (1 << (N - i - 1));
			k2 = k2 / 2;
		}
		re[bk2][1] = b[i];
	}
	f(i, N) {
		k = 1;
		bk = 1;
		k2 = 1;
		bk2 = 1;
		f(j, i + 1) {
			k = k * 2;
			k2 = k2 * 2;
		}
		f(j, N - i - 1) {
			bk = bk * 2;
			bk2 = bk2 * 2;
		}
		x = 0;
		f(j, k2) {
			cp[j] = cos(x);
			sp[j] = sin(x);
			x += (PI * 2) / k;
		}
		k = k / 2;
		k2 = k2 / 2;
		f(ii, bk2) {
			f(j, k2) {
				re[(ii*k2 * 2) + j][2] = re[(ii*k2 * 2) + j][1] + (re[(ii*k2 * 2) + k2 + j][1] * cp[j]) - (im[(ii*k2 * 2) + k2 + j][1] * sp[j]);
				im[(ii*k2 * 2) + j][2] = im[(ii*k2 * 2) + j][1] + (re[(ii*k2 * 2) + k2 + j][1] * sp[j]) + (im[(ii*k2 * 2) + k2 + j][1] * cp[j]);
				re[(ii*k2 * 2) + k2 + j][2] = re[(ii*k2 * 2) + j][1] + (re[(ii*k2 * 2) + k2 + j][1] * cp[k2 + j]) - (im[(ii*k2 * 2) + k2 + j][1] * sp[k2 + j]);
				im[(ii*k2 * 2) + k2 + j][2] = im[(ii*k2 * 2) + j][1] + (re[(ii*k2 * 2) + k2 + j][1] * sp[k2 + j]) + (im[(ii*k2 * 2) + k2 + j][1] * cp[k2 + j]);
			}
		}
		f(j, (1 << N)) {
			re[j][1] = re[j][2];
			im[j][1] = im[j][2];
		}
	}
	f(j, (1 << N)) {
		re[j][2] = (re[j][0] * re[j][1]) - (im[j][0] * im[j][1]);
		im[j][2] = (re[j][0] * im[j][1]) + (im[j][0] * re[j][1]);
	}

	f(i, (1 << N)) {
		k2 = i;
		bk2 = 0;
		f(j, N) {
			if (k2 % 2 == 1)bk2 += (1 << (N - j - 1));
			k2 = k2 / 2;
		}
		re[bk2][0] = re[i][2];
		im[bk2][0] = im[i][2];
	}
	f(i, N) {
		k = 1;
		bk = 1;
		k2 = 1;
		bk2 = 1;
		f(j, i + 1) {
			k = k * 2;
			k2 = k2 * 2;
		}
		f(j, N - i - 1) {
			bk = bk * 2;
			bk2 = bk2 * 2;
		}
		x = 0;
		f(j, k2) {
			cp[j] = cos(x);
			sp[j] = -sin(x);
			x += (PI * 2) / k;
		}
		k = k / 2;
		k2 = k2 / 2;
		f(ii, bk2) {
			f(j, k2) {
				re[(ii*k2 * 2) + j][2] = re[(ii*k2 * 2) + j][0] + (re[(ii*k2 * 2) + k2 + j][0] * cp[j]) - (im[(ii*k2 * 2) + k2 + j][0] * sp[j]);
				im[(ii*k2 * 2) + j][2] = im[(ii*k2 * 2) + j][0] + (re[(ii*k2 * 2) + k2 + j][0] * sp[j]) + (im[(ii*k2 * 2) + k2 + j][0] * cp[j]);
				re[(ii*k2 * 2) + k2 + j][2] = re[(ii*k2 * 2) + j][0] + (re[(ii*k2 * 2) + k2 + j][0] * cp[k2 + j]) - (im[(ii*k2 * 2) + k2 + j][0] * sp[k2 + j]);
				im[(ii*k2 * 2) + k2 + j][2] = im[(ii*k2 * 2) + j][0] + (re[(ii*k2 * 2) + k2 + j][0] * sp[k2 + j]) + (im[(ii*k2 * 2) + k2 + j][0] * cp[k2 + j]);
			}
		}
		f(j, (1 << N)) {
			re[j][0] = re[j][2];
			im[j][0] = im[j][2];
		}
	}
	zz = 1;
	f(i, MOD + MOD - 1) {
		re[i][0] = re[i][0] / (1 << N);
		ans[i] = floor(re[i][0] + 0.5);
		fians += ans[i] * zz;
		zz = (zz * 2) % MOD;
	}
	printf("%lld\n", fians / 2);
	return 0;
}


Measured memory_bytes: 77456