#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <cstring>
#include <list>  
#include <cassert>
#include <climits>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
std::mt19937 rnd((int)std::chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

struct complex {
	double x, y; complex(double x = 0, double y = 0) :x(x), y(y) {}
	const inline complex operator+(const complex& b) const { return complex(x + b.x, y + b.y); }
	const inline complex operator-(const complex& b) const { return complex(x - b.x, y - b.y); }
	const inline complex operator*(const complex& b) const { return complex(x * b.x - y * b.y, x * b.y + y * b.x); }
	const inline void operator-=(const complex& b) { x -= b.x; y -= b.y; }
	const inline void operator+=(const complex& b) { x += b.x; y += b.y; }
};
void fft(complex* x, int n, int type) {
	vector<complex> ww(n); ww[0] = complex(1, 0);
	for (int step = n >> 1; step > 0; step >>= 1) {
		double r = 2 * acos(-1) / (n / step); complex unit(cos(r), sin(r));
		for (int i = 0; i < n; i += 2 * step) ww[i + step] = ww[i] * unit;
	}
	if (type != +1) { for (int i = 1; i <= n - i; ++i) swap(ww[i], ww[n - i]); }
	for (int i = 1, j = 0; i < n - 1; ++i) {
		for (int s = n; j ^= s >>= 1, ~j & s;);
		if (i < j) swap(x[i], x[j]);
	}
	for (int d = 0; (1 << d) < n; ++d) {
		int m = 1 << d, m2 = m * 2, step = n / m / 2;
		for (int i = 0; i < n; i += m2) {
			complex* l = x + i, * r = x + i + m, * w = ww.data();
			for (int j = 0; j < m; ++j, ++l, ++r, w += step) {
				complex s = *l, t = *r * *w;
				*l = s + t, * r = s - t;
			}
		}
	}
}
void fftmult(complex* a, complex* b, complex* c, int n) {
	fft(a, n, +1);
	fft(b, n, +1);
	REP(i, n) c[i] = a[i] * b[i];
	fft(c, n, -1);
	REP(i, n) c[i].x /= n, c[i].y /= n;
}

const int PRIMROOT = 5;
const int MOD = 200003;
const int MAXN = 200000;
const int FFTN = 1 << 19;


int n;
int a[MAXN];

int atob[MOD];
int b[MAXN];

int c[MOD];
complex A[FFTN];
complex B[FFTN];
complex C[FFTN];

ll d[FFTN];

ll solve() {
	REP(i, MOD) atob[i] = -1;
	{ int x = 0, y = 1; while (true) { atob[y] = x; ++x; y = (ll)y * PRIMROOT % MOD; if (y == 1) break; } }
	REP(i, n) b[i] = atob[a[i]];
	REP(i, MOD) c[i] = 0;
	REP(i, n) if (b[i] != -1) ++c[b[i]];

	REP(i, FFTN) A[i] = B[i] = complex(0, 0);
	REP(i, MOD) A[i] = B[i] = complex(c[i], 0);
	fftmult(A, B, C, FFTN);

	REP(i, FFTN) d[i] = floor(C[i].x + 0.5);
	REP(i, n) if (b[i] != -1) --d[b[i] + b[i]];
	REP(i, FFTN) assert(d[i] % 2 == 0), d[i] /= 2;
	//REP(i, FFTN) if (d[i] != 0) printf("%d: %lld\n", i, d[i]);

	ll ret = 0;
	{ int y = 1; REP(i, FFTN) { ret = ret + d[i] * y; y = (ll)y * PRIMROOT % MOD; } }
	return ret;
}

void run() {
	scanf("%d", &n);
	REP(i, n) scanf("%d", &a[i]);
	printf("%lld\n", solve());

}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 44116