#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}


const ll MOD = 200003;
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p - 1));
	return bin_pow(mult(x, x), p / 2);
}
ll rev(ll x) {
	return bin_pow(x, MOD - 2);
}

const int LOG = 19;
const int N = 1 << LOG;
const int NN = N + 5;
const double PI = 4 * atan(1);
using cd = complex<double>;
cd w[NN];
int binRev[NN];

void initFFT() {
	for (int i = 0; i < N; i++)
		w[i] = cd(cos(2 * PI * i / N), sin(2 * PI * i / N));
	for (int mask = 1; mask < N; mask++)
		binRev[mask] = (binRev[mask >> 1] >> 1) ^ ((mask & 1) << (LOG - 1));
}

void FFT(cd* A) {
	for (int i = 0; i < N; i++)
		if (i < binRev[i])
			swap(A[i], A[binRev[i]]);
	for (int lvl = 0; lvl < LOG; lvl++) {
		int len = 1 << lvl;
		for (int st = 0; st < N; st += (len << 1))
			for (int i = 0; i < len; i++) {
				cd x = A[st + i], y = A[st + len + i] * w[i << (LOG - 1 - lvl)];
				A[st + i] = x + y;
				A[st + len + i] = x - y;
			}
	}
}

cd A[NN];

int lg[NN];
int pw[NN];
int a[NN];
ll b[NN];

ll myRound(double x) {
	return (ll)(x + 0.5);
}

vector<ll> getDivs(ll x) {
	vector<ll> res;
	for (ll p = 2; p * p <= x; p++) {
		if (x % p) continue;
		res.push_back(p);
		while(x / p == 0) x /= p;
	}
	if (x > 1) res.push_back(x);
	return res;
}
ll findRoot() {
	vector<ll> d = getDivs(MOD - 1);
	while(true) {
		ll x = 2 + myRand(MOD - 2);
		bool ok = true;
		for (ll p : d) {
			ok &= bin_pow(x, (MOD - 1) / p) != 1;
		}
		if (ok) return x;
	}
}

int main()
{
	startTime = clock();
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	initFFT();

	ll g = findRoot();
	ll x = 1;
	for (int i = 0; i < MOD - 1; i++) {
		pw[i] = x;
		lg[x] = i;
		x = mult(x, g);
	}

	int n;
	scanf("%d", &n);
	while(n--) {
		int x;
		scanf("%d", &x);
		if (x == 0) continue;
		a[lg[x]]++;
	}
	for (int i = 0; i < MOD; i++)
		A[i] = a[i];
	FFT(A);
	for (int i = 0; i < N; i++)
		A[i] *= A[i];
	FFT(A);
	reverse(A + 1, A + N);
	for (int i = 0; i < N; i++)
		b[i] = myRound(A[i].real() / N);

	ll ans = 0;
	for (int i = 0; i < N; i++)
		ans += (ll)b[i] * pw[i % (MOD - 1)];
	for (int i = 0; i < N; i++)
		ans -= (ll)a[i] * pw[(2 * i) % (MOD - 1)];
	ans /= 2;
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 28696