#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Vec = vector<ll>;
#define REP(i, m, n) for(ll i = (m); i < (n); ++i)
#define rep(i, n) REP(i, 0, n)
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
constexpr ll LINF = 1e18L+1;
constexpr ll MOD = 1e9+7;
const double PI = acos(-1.0);

template <int mod>
struct ModInt {
	int x;

	ModInt() : x(0) {}

	ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

	ModInt &operator+=(const ModInt &p) {
		if((x += p.x) >= mod) x -= mod;
		return *this;
	}

	ModInt &operator-=(const ModInt &p) {
		if((x += mod - p.x) >= mod) x -= mod;
		return *this;
	}

	ModInt &operator*=(const ModInt &p) {
		x = (int) (1LL * x * p.x % mod);
		return *this;
	}

	ModInt &operator/=(const ModInt &p) {
		*this *= p.inverse();
		return *this;
	}

	ModInt &operator++() {
		if((++x) >= mod) x -= mod;
		return *this;
	}

	ModInt operator++(int) {
		ModInt tmp(*this);
		operator++();
		return tmp;
	}

	ModInt &operator--() {
		if((x += mod - 1) >= mod) x -= mod;
		return *this;
	}

	ModInt operator--(int) {
		ModInt tmp(*this);
		operator--();
		return tmp;
	}

	ModInt operator-() const { return ModInt(-x); }

	ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

	ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

	ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

	ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

	bool operator==(const ModInt &p) const { return x == p.x; }

	bool operator!=(const ModInt &p) const { return x != p.x; }

	ModInt inverse() const {
		int a = x, b = mod, u = 1, v = 0, t;
		while(b > 0) {
			t = a / b;
			swap(a -= t * b, b);
			swap(u -= t * v, v);
		}
		return ModInt(u);
	}

	ModInt pow(int64_t n) const {
		ModInt res(1), mul(x);
		while(n > 0) {
			if(n & 1) res *= mul;
			mul *= mul;
			n >>= 1;
		}
		return res;
	}

	friend ostream &operator<<(ostream &os, const ModInt &p) {
		return os << p.x;
	}

	friend istream &operator>>(istream &is, ModInt &a) {
		int64_t t;
		is >> t;
		a = ModInt< mod >(t);
		return (is);
	}

	static int get_mod() { return mod; }
};
using Mint = ModInt<MOD>;

using CP = complex<double>;

void fft(vector<CP> &a, bool inv){
	int N = a.size();
	int n = 2, d = N / 2;
	vector<CP> cp(N);
	while (n <= N) {
		for (int p = 0; p < d; ++p) {
			CP omega = polar(1.0, (-2 * inv + 1) * 2 * PI / n);
			CP pow_omega = 1.0;
			for (int i = 0; i < n / 2; ++i) {
				cp[p + d * i] = a[p + 2 * d * i] + pow_omega * a[p + 2 * d * i + d];
				cp[p + d * i + N / 2] = a[p + 2 * d * i] - pow_omega * a[p + 2 * d * i + d];
				pow_omega *= omega;
			}
		}

		swap(a, cp);
		n <<= 1, d >>= 1;
	}
}

void conv(vector<CP> &a, vector<CP> b){
	int n = a.size() + b.size();
	int N = 1;
	while (N <= n) N <<= 1;

	a.resize(N);
	b.resize(N);

	fft(a, false);
	fft(b, false);

	for (int i = 0; i < N; ++i) {
		a[i] *= b[i] / CP(N);
	}

	fft(a, true);
}

vector<ll> pn;

bool is_prime(ll n){
	if(n == 1) return false;
	for(ll i : pn){
		if(i * i > n) return true;
		if(n % i == 0) return false;
	}
	return true;
}

void init(ll n = 2e5){
	if(!pn.empty() && pn.back() >= n) return;
	pn.push_back(2);
	for(int i = 3; i < n + 100; ++i) if(is_prime(i)) pn.push_back(i);
}

vector<P> prime_factorization(ll n){
	init();
	vector<P> res;

	for(ll i : pn){
		ll cnt = 0;
		while(n % i == 0){
			n /= i;
			cnt++;
		}
		if(cnt) res.push_back({i, cnt});
		if(n < i * i) break;
	}
	if(n != 1) res.push_back({n, 1});

	return res;
}

Vec divisor_enumeration(ll n){
	auto v = prime_factorization(n);

	Vec res, a, b, cp;
	res.push_back(1);
	for(auto p : v){
		cp.resize(res.size());
		copy(res.begin(), res.end(), cp.begin());
		a.resize(res.size());
		for(int k = 1; k <= p.second; ++k){
			ll t = pow(p.first, k);
			for(int i = 0; i < a.size(); ++i) a[i] = cp[i] * t;
			merge(res.begin(), res.end(), a.begin(), a.end(), back_inserter(b));
			swap(res, b);
			b.clear();
		}
	}

	return res;
}

ll find_root(ll p){
	auto v = divisor_enumeration(p - 1);

	for(ll i : v){
		unordered_set<ll> used;
		ll t = 1;
		bool flg = true;
		for(ll j = 0; j < p - 2; ++j){
			(t *= i) % p;
			if(used.find(t) != used.end()) {
				flg = false;
				break;
			}
			used.insert(t);
		}
		if(flg) return i;
	}
	return 0;
}

constexpr int Pr = 200003;

int main(void) {
	ll n;
	cin >> n;
	Vec a(Pr);
	ll ans = 0;
	rep(i, n){
		ll t;
		cin >> t;
		a[t]++;
		ans -= t * t % Pr;
	}

	ll r = find_root(Pr);

	Vec tmp(Pr);
	ll t = 1;
	rep(i, Pr-1){
		tmp[i] = a[t];
		(t *= r) %= Pr;
	}
	swap(a, tmp);

	vector<CP> z(Pr);
	rep(i, Pr) z[i] = CP(a[i]);
	conv(z, z);

	t = 1;
	a.assign(Pr, 0);
	rep(i, z.size()){
		if(z[i].real() + 0.5 < 0) cerr << i << " " << z[i].real() << endl;
		a[t] += ll(z[i].real() + 0.5);
		(t *= r) %= Pr;
	}

	rep(i, Pr){
		ans += i * a[i];
	}
	cout << ans / 2 << endl;

	return 0;
}


Measured memory_bytes: 36372