/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <math.h>
#include <memory.h>
#include <stdio.h>

#include <algorithm>
#include <complex>
#include <ctime>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define left asdgashgrketwjklrej
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh
#define hash asdgasdgasdgdfrywewery

#define eps 1e-12
#define M_PI 3.141592653589793
#define bsize 1024

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 200031;

int n,ar[N];

int MOD=200003;

int P[N],RP[N];
int cnt[N];
long long prod[N];

vector<pair<int,int> > order;
typedef complex<long double> base;

void fft (vector<base> & a, bool invert) {
	int n = (int) a.size();

	for (int i=1, j=0; i<n; ++i) {
		int bit = n >> 1;
		for (; j>=bit; bit>>=1)
			j -= bit;
		j += bit;
		if (i < j)
			swap (a[i], a[j]);
	}

	for (int len=2; len<=n; len<<=1) {
		long double ang = 2*M_PI/len * (invert ? -1 : 1);
		base wlen (cos(ang), sin(ang));
		for (int i=0; i<n; i+=len) {
			base w(1.0);
			for (int j=0; j<len/2; ++j) {
				base u = a[i+j],  v = a[i+j+len/2] * w;
				a[i+j] = u + v;
				a[i+j+len/2] = u - v;
				w *= wlen;
			}
		}
	}
	if (invert)
		for (int i=0; i<n; ++i)
			a[i] /= n;
}

void multiply (const vector<long long> & a, const vector<long long> & b, vector<long long> & res) {
	vector<base> fa (a.begin(), a.end()),  fb (b.begin(), b.end());
	size_t n = 1;
	while (n < max (a.size(), b.size()))  n <<= 1;
	n <<= 1;
	fa.resize (n),  fb.resize (n);

	fft (fa, false),  fft (fb, false);
	for (size_t i=0; i<n; ++i)
		fa[i] *= fb[i];
	fft (fa, true);

	res.resize (n);
	for (size_t i=0; i<n; ++i)
		res[i] = (fa[i].real() + 0.5);
}

int main() {
   //freopen("input.txt", "r", stdin);
   //freopen("output.txt", "w", stdout);
  ios_base::sync_with_stdio(0);
  // cin.tie(0);

  P[1]=0;
  long long x=1;
  for (int i=1;i<MOD-1;i++){
	  x=x*2%MOD;
	  P[x]=i;
  }

  for (int i=1;i<MOD;i++){
	  RP[P[i]]=i;
  }

  cin>>n;
  for (int i=1;i<=n;i++){
	  cin>>ar[i];
	  if (ar[i]==0)
		  continue;
	  cnt[P[ar[i]]]++;
  }

  vector<long long> V1,V2;
  for (int i=0;i<MOD;i++){
	  V1.push_back(cnt[i]);
	  V2.push_back(cnt[i]);
  }

  vector<long long> res;

  multiply(V1,V2,res);


  for (int i=0;i<MOD;i++){
	  if (cnt[i])
		  order.push_back(make_pair(cnt[i],i));
  }

  for (int i=0;i<res.size();i++){
	  prod[i%(MOD-1)]+=res[i];
  }

/*  for (int i=0;i<order.size();i++){
	  for (int j=0;j<order.size();j++){
		  prod[(order[i].second+order[j].second)%(MOD-1)]+=order[i].first*order[j].first;
	  }
  }*/



  for (int i=0;i<order.size();i++){
	  prod[order[i].second*2%(MOD-1)]-=order[i].first;
  }

  for (int i=0;i<MOD;i++){
	  prod[i]/=2;
  }

  long long ans=0;

  for (int i=0;i<MOD;i++){
	  ans+=RP[i]*prod[i];
  }

  cout<<ans<<endl;

  cin.get(); cin.get();
  return 0;
}


Measured memory_bytes: 48912