#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << #x << ':' << (x) << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }

ll modinv(ll a, ll mod) {
	a %= mod;
	if (a == 0) abort();
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

ll modpow(ll a, ll b, ll m) {
	ll ans = 1;
	a %= m;
	while (b) {
		if (b & 1) ans = ans * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return ans;
}

void ntt(vector<ll> &f, bool inv, ll mod, ll root) {
	int N = f.size();
	int h = modpow(root, (mod - 1) / N, mod);
	if (inv) h = modinv(h, mod);
	for (int i = 0, j = 1; j < N - 1; ++j) {
		for (int k = N >> 1; k > (i ^= k); k >>= 1);
		if (j < i) swap(f[i], f[j]);
	}
	for (int i = 1, j = 2; i < N; i *= 2, j *= 2) {
		ll w = 1, base = modpow(h, N / j, mod);
		for (int k = 0; k < i; ++k, (w *= base) %= mod) {
			for (int l = k; l < N; l += j) {
				ll u = f[l];
				ll d = f[l + i] * w % mod;
				f[l] = u + d;
				if (f[l] >= mod) f[l] -= mod;
				f[l + i] = u - d;
				if (f[l + i] < 0) f[l + i] += mod;
			}
		}
	}
	for (auto& x : f) if (x < 0) x += mod;
}

vector<ll> convolution(vector<ll> f, vector<ll> g, ll mod, ll root) {
	int n = 1;
	while (n < f.size() + g.size() + 2) n <<= 1;
	f.resize(n); g.resize(n);
	ntt(f, false, mod, root); ntt(g, false, mod, root);
	vector<ll> res(n);
	for (int i = 0; i < n; i++) res[i] = f[i] * g[i] % mod;
	ntt(res, true, mod, root);
	ll inv = modinv(n, mod);
	for (int i = 0; i < n; i++) res[i] = res[i] * inv % mod;
	return res;
}

constexpr ll M = 200003;
constexpr ll r = 2;
constexpr ll mod1 = 998244353, mod2 = 924844033;

ll garner(ll r1, ll r2) {
	ll v = r2 - r1;
	if (v < 0) v += mod2;
	v *= modinv(mod1, mod2);
	v %= mod2;
	return r1 + v * mod1;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	vector<ll> table(M);
	ll now = 1;
	rep(i, M - 1) {
		table[now] = i;
		now *= r; now %= M;
	}
	vector<ll> c(M);
	int n;
	cin >> n;
	ll ans = 0;
	rep(i, n) {
		ll a;
		cin >> a;
		if (a) c[table[a]]++;
		ans -= a * a % M;
	}
	vector<ll> x = convolution(c, c, mod1, 3);
	vector<ll> y = convolution(c, c, mod2, 5);
	int sz = x.size();
	vector<ll> z(sz);
	rep(i, sz) z[i] = garner(x[i], y[i]);
	vector<ll> powmemo(M);
	powmemo[0] = 1;
	rep(i, M - 1) powmemo[i + 1] = powmemo[i] * r % M;
	rep(i, sz) ans += powmemo[i % (M - 1)] * z[i];
	cout << ans / 2 << '\n';
}

Measured memory_bytes: 25868