#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <complex>
using namespace std;

/* debug macros */
#ifdef WAFDAYO
#define DBG_LINE() {std::cerr<<"\e[2m[L"<<__LINE__<<"]\e[m ";}
#define DBG_PRINT(s,t,u) {std::cerr<<(s)<<" \e[2m=\e[m \e[1m"<<(t)<<"\e[m"<<(u);}
#define SELECT_7TH(x1,x2,x3,x4,x5,x6,x7,...) x7
#define dbg1(x1) DBG_PRINT(#x1,x1,std::endl)
#define dbg2(x1,x2) DBG_PRINT(#x1,x1,", ")dbg1(x2)
#define dbg3(x1,x2,x3) DBG_PRINT(#x1,x1,", ")dbg2(x2,x3)
#define dbg4(x1,x2,x3,x4) DBG_PRINT(#x1,x1,", ")dbg3(x2,x3,x4)
#define dbg5(x1,x2,x3,x4,x5) DBG_PRINT(#x1,x1,", ")dbg4(x2,x3,x4,x5)
#define dbg6(x1,x2,x3,x4,x5,x6) DBG_PRINT(#x1,x1,", ")dbg5(x2,x3,x4,x5,x6)
#define dbg(...) DBG_LINE()\
SELECT_7TH(__VA_ARGS__,dbg6,dbg5,dbg4,dbg3,dbg2,dbg1)(__VA_ARGS__)
#else
#define dbg(...) {}
#endif

/* utility functions */
struct read_item{read_item(){};
template<class T>operator T(){T t;std::cin>>t;return t;}};
char splf(int i,int n){return(i+1<n)?' ':'\n';};
template<bool up>
struct _RI{int i;_RI(int a):i(a){}
int operator*(){return i;}void operator++(){i+=(up?1:-1);}
bool operator!=(const _RI& r){return up?i<r.i:i>=r.i;}};
template<bool up>
struct _RX{_RI<up> x,y;_RI<up> begin(){return x;}_RI<up> end(){return y;}
_RX(int a,int b):x(up?a:(a-1)),y(b){}_RX(int a):_RX(up?0:a,up?a:0){}};
typedef _RX<true> range;
typedef _RX<false> revrange;

/* types and constants */
typedef int64_t i64;
typedef uint64_t u64;
// const i64 inf = (i64)1.05e18;
// const int inf = (int)1.05e9;

using dcomplex = complex<double>;
const double PI = 3.141592653589;

vector<dcomplex> dft(vector<dcomplex>& xs, int n, bool inv) {

	if(n == 1) {
		vector<dcomplex> ys(1);
		ys[0] = xs[0];
		return ys;
	}

	const int hn = n / 2;
	vector<dcomplex> x0(hn), x1(hn);
	for(auto i : range(hn)) {
		x0[i] = xs[i * 2 + 0];
		x1[i] = xs[i * 2 + 1];
	}

	vector<dcomplex> y0 = dft(x0, hn, inv);
	vector<dcomplex> y1 = dft(x1, hn, inv);
	vector<dcomplex> y(n);

	auto zeta = dcomplex(cos(2 * PI / n), inv ? -sin(2 * PI / n) : sin(2 * PI / n));
	dcomplex pow_zeta = 1;
	for(auto i : range(n)) {
		y[i] = y0[i % hn] + pow_zeta * y1[i % hn];
		pow_zeta = pow_zeta * zeta;
	}

	return y;
}


vector<i64> multiply(vector<i64>& ixs, vector<i64>& iys) {

	int n_lo = ixs.size() + iys.size() + 1;
	int n = 1;
	while(n < n_lo) {
		n = n * 2;
	}

	vector<dcomplex> xs(n), ys(n);
	for(auto i : range(n)) {
		xs[i] = (i < ixs.size()) ? ixs[i] : 0;
		ys[i] = (i < iys.size()) ? iys[i] : 0;
	}

	auto xf = dft(xs, n, false);
	auto yf = dft(ys, n, false);
	vector<dcomplex> zf(n);
	for(auto i : range(n)) {
		zf[i] = xf[i] * yf[i];
	}

	auto zs = dft(zf, n, true);
	vector<i64> izs(n);
	for(auto i : range(n)) {
		izs[i] = round(abs(zs[i]) / n);
	}

	return izs;
}

vector<int> compute_logs(const int P) {

	vector<int> logs(P, -1);

	int root = 2;
	int x = root;
	int k = 1;

	while(k == 1 || x != root) {
		logs[x] = k;
		x = x * root % P;
		k += 1;
	}

	return logs;
}

int main() {

	const int P = 200003;

	const int N = read_item();
	vector<int> As(N);
	for(auto i :range(N)) {
		As[i] = read_item();
		if(As[i] >= P) {
			As[i] = As[i] % P;
		}
	}

	vector<int> logs = compute_logs(P);
	vector<int> exps(P);

	fill(exps.begin(), exps.end(), -1);
	for(auto i : range(1, P)) {
		assert(logs[i] != -1);
		exps[logs[i]] = i;
	}
	exps[0] = 1;

	int zeros = 0;
	vector<i64> Bs(P);

	for(auto a : As) {
		if(a == 0) {
			zeros += 1;
		} else {
			Bs[logs[a]] += 1;
		}
	}

	i64 ans = 0;
	vector<i64> Cs = multiply(Bs, Bs);

	for(auto i : range(2 * P)) {
		ans += exps[i % (P - 1)] * Cs[i];
	}

	for(auto i : range(N)) {
		ans -= ((i64)As[i] * As[i]) % P;
	}

	printf("%lld\n", ans / 2);

	return 0;
}

/* wafdayo~~~ */


Measured memory_bytes: 83616