#ifndef _SELF_UTILITY
#define _SELF_UTILITY 1
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#include <bitset>
#define Endl endl
#define mp make_pair
#define ll long long 
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define quickcin ios_base::sync_with_stdio(false);
const int mod=200003;
const int gmod=2;
const int inf=1039074182;
const ll llinf=1LL*inf*inf;
template <typename T1,typename T2> inline void chmin(T1 &x,T2 b) {if(b<x) x=b;}
template <typename T1,typename T2> inline void chmax(T1 &x,T2 b) {if(b>x) x=b;}
template <typename T1,typename T2> inline void chadd(T1 &x,T2 b) {x+=b;if(x>=mod) x-=mod;}
template <typename T1,typename T2> inline void chmul(T1 &x,T2 b) {x=1LL*x*b%mod;}
template <typename T1,typename T2> inline void chmod(T1 &x,T2 b) {x%=b,x+=b;if(x>=b) x-=b;}
#endif

#ifndef _SELF_DEBUG
#define _SELF_DEBUG 1
#ifndef _SELF_OPERATOR
#define _SELF_OPERATOR 1
#ifndef _SELF_UTILITY
#define _SELF_UTILITY 1
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#include <bitset>
#define Endl endl
#define mp make_pair
#define ll long long 
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define quickcin ios_base::sync_with_stdio(false);
const int mod=200003;
const int gmod=2;
const int inf=1039074182;
const ll llinf=1LL*inf*inf;
template <typename T1,typename T2> inline void chmin(T1 &x,T2 b) {if(b<x) x=b;}
template <typename T1,typename T2> inline void chmax(T1 &x,T2 b) {if(b>x) x=b;}
template <typename T1,typename T2> inline void chadd(T1 &x,T2 b) {x+=b;if(x>=mod) x-=mod;}
template <typename T1,typename T2> inline void chmul(T1 &x,T2 b) {x=1LL*x*b%mod;}
template <typename T1,typename T2> inline void chmod(T1 &x,T2 b) {x%=b,x+=b;if(x>=b) x-=b;}
#endif

using namespace std;
template <typename T>
ostream & operator << (ostream& cout,vector<T> vec)
{
	cout<<"{";
	for(int i=0;i<vec.size();i++)
	{
		cout<<vec[i];
		if(i!=(int)vec.size()-1) cout<<',';
	}
	cout<<"}";
	return cout;
}

template <typename T1,typename T2>
ostream & operator << (ostream & cout,pair<T1,T2> p)
{
	cout<<"("<<p.first<<','<<p.second<<")";
	return cout;
}

template <typename T>
ostream & operator << (ostream & cout,set <T> s)
{
	vector <T> t;
	for(auto x:s) t.push_back(x);
	cout<<t;
	return cout;
}

template <typename T>
ostream & operator << (ostream &cout,queue <T> q)
{
	vector <T> t;
	while(q.size())
	{
		t.push_back(q.front());
		q.pop();
	}
	cout<<t;
	return cout;
}

template <typename T1,typename T2>
ostream & operator << (ostream &cout,map <T1,T2> m)
{
	for(auto &x:m)
	{
		cout<<"Key: "<<x.first<<' '<<"Value: "<<x.second<<endl;
	}
	return cout;
}

template <typename T>
T operator * (vector <T> v1,vector <T> v2)
{
	assert(v1.size()==v2.size());
	int n=v1.size();
	T res=0;
	for(int i=0;i<n;i++)
	{
		res+=v1[i]*v2[i];
	}
	return res;
}

template <typename T1,typename T2>
pair<T1,T2> operator + (pair<T1,T2> x,pair<T1,T2> y)
{
	return make_pair(x.first+y.first,x.second+y.second);
}

template <typename T1,typename T2>
pair<T1,T2> operator - (pair<T1,T2> x)
{
	return make_pair(-x.first,-x.second);
}

template <typename T>
vector<vector<T> > operator ~ (vector<vector <T> > vec)
{
	vector <vector<T> > v;
	int n=vec.size(),m=vec[0].size();
	v.resize(m);
	for(int i=0;i<m;i++)
	{
		v[i].resize(n);
	}
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<n;j++)
		{
			v[i][j]=vec[j][i];
		}
	}
	return v;
}
#endif

void print0x(int x)
{
	std::vector <int> vec;
	while(x)
	{
		vec.push_back(x&1);
		x>>=1;
	}
	std::reverse(vec.begin(),vec.end());
	for(int i=0;i<vec.size();i++)
	{
		std::cout<<vec[i];
	}
	std::cout<<' ';
}

template <typename T>
void print0x(T x,int len)
{
	std::vector <int> vec;
	while(x)
	{
		vec.push_back(x&1);
		x>>=1;
	}
	reverse(vec.begin(),vec.end());
	for(int i=vec.size();i<len;i++)
	{
		putchar('0');
	}
	for(int i=0;i<vec.size();i++)
	{
		std::cout<<vec[i];
	}
	std::cout<<' ';
}
#endif
#include <complex>
#ifndef cplx
	#define cplx complex <long double>
#endif

namespace FFT
{
	typedef ll T;
	const int N=4e5+5;
	const long double pi=3.141592653589793238462643383279;
	cplx ta[N*2+5],tb[N*2+5],tc[N*2+5];
	cplx UnitRoot[N*2+5];
	cplx a[2*N+5],buf[2*N+5];
	int inv[2*N+5];
	int nn;
	
	ostream & operator << (ostream &out,vector <cplx> v)
	{
		if(v.size()==0)
		{
			out<<"{}";
			return out;
		}
		for(int i=0;i<v.size();i++)
		{
			if(i==0) out<<"{";else out<<",";
			out<<v[i];
		}
		out<<"}";
	}
	
	cplx zeta(int a,int b)
	{
		return UnitRoot[nn/a*b];
	}
	
	inline vector <cplx> fft(vector <cplx> v,int rev)
	{
		int n=1;
		int lg=0;
		while(n<(int)v.size())
		{
			n<<=1;
			lg++;
		}
		inv[0]=0;
		for(int i=1;i<n;i++)
		{
			inv[i]=(inv[i>>1]>>1) | ((i&1)<<(lg-1));
		}
		for(int i=0;i<n;i++)
		{
			a[inv[i]]=v[i];
		}
		for(int m=2;m<=n;m<<=1)
		{
			for(int j=0;j<n;j+=m)
			{
				for(int i=0;i<m;i++)
				{
					buf[j+i]=a[i%(m/2)+j]+a[i%(m/2)+j+m/2]*(rev==1?zeta(m,i):zeta(m,m-i));
				}
			}
			memcpy(a,buf,sizeof(a));
		}
		for(int i=0;i<n;i++)
		{
			v[i]=a[i];
		}
		return v;
	}
	
	inline vector <T> multiply(vector <T> a,vector <T> b)
	{
		int nn=1;
		while(nn<((int)a.size()+(int)b.size())) nn<<=1;
		vector <cplx> va(nn);
		for(int i=0;i<nn;i++)
		{
			if(i<a.size()) va[i]=a[i];else va[i]=(0,0);
		}
		va=fft(va,1);
		vector <cplx> vb(nn);
		for(int i=0;i<nn;i++)
		{
			if(i<b.size()) vb[i]=b[i];else vb[i]=(0,0);
		}
		vb=fft(vb,1);
		for(int i=0;i<nn;i++)
		{
			va[i]=va[i]*vb[i];
		}
		va=fft(va,-1);
		vector <T> res(nn);
		for(int i=0;i<nn;i++)
		{
			res[i]=round(va[i].real()/nn);
		}
		while(!res.empty() && res.back()==0) res.pop_back();
		return res;
	}
	
	void init()
	{
		nn=1;
		while(nn<N) nn<<=1;
		UnitRoot[0]=1;
		cplx ur{cos(2.0*pi/nn),sin(2.0*pi/nn)};
		for(int i=1;i<=nn;i++)
		{
			UnitRoot[i]=UnitRoot[i-1]*ur;
		}
	}
};
using namespace std;
int n;
int a[200005];
int e[200005],dive[200005];
int id[200005];
vector <ll> s;

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n;
	int k=0;
	for(int i=0;i<n;i++)
	{
		scanf("%d",a+k);
		if(a[k]==0) continue;
		k++;
	}
	n=k;
	e[0]=1;
	dive[0]=0;
	for(int i=1;i<mod;i++)
	{
		e[i]=e[i-1]*gmod;
		dive[i]=dive[i-1];
		if(e[i]>=mod)
		{
			dive[i]+=e[i]/mod;
			e[i]%=mod;
		}
	}
	for(int i=0;i<mod;i++)
	{
		id[e[i]]=i;
	}
	s.resize(mod,0);
	for(int i=0;i<n;i++)
	{
		s[id[a[i]]]++;
	}
//	for(int i=0;i<s.size();i++)
//	{
//		if(s[i]!=0) cout<<s[i]<<"*x^"<<i<<endl;
//	}
	FFT::init();
	s=FFT::multiply(s,s);
	ll res=0;
	for(int i=0;i<s.size();i++)
	{
//		if(s[i]!=0) cout<<s[i]<<"*x^"<<i<<endl;
		res+=1LL*s[i]*(e[i%(mod-1)]);
	}
	for(int i=0;i<n;i++)
	{
		res-=1LL*a[i]*a[i]%mod;
	}
	assert(res%2==0);
	res/=2;
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 120332