#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <cstring>
#include <bitset>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#ifdef ENABLE_LL
#define int long long
#endif

#ifdef ENABLE_LL
#define I "%lld"
#define II "%lld%lld"
#define III "%lld%lld%lld"
#define IIII "%lld%lld%lld%lld"
#define IN "%lld\n"
#define IIN "%lld%lld\n"
#define IIIN "%lld%lld%lld\n"
#define IIIIN "%lld%lld%lld%lld\n"
#else
#define I "%d"
#define II "%d%d"
#define III "%d%d%d"
#define IIII "%d%d%d%d"
#define IN "%d\n"
#define IIN "%d%d\n"
#define IIIN "%d%d%d\n"
#define IIIIN "%d%d%d%d\n"
#endif

#ifdef __LOCALE__
#define see(a) std::cout << #a << "=" << a << std::endl
#define ses(a) std::cout << #a << "=" << a << " " 
#else
#define see(a) //std::cout << #a << "=" << a << std::endl
#define ses(a)
#endif
#define repe(a,b) for (int a=0;a<(int)b.size();a++)
#define rep(i,n) for (int i=0;i<n;i++)
#define repa(i,n) for (int i=1;i<=n;i++)
#define repi(i,a,b) for (int i=a;i<=b;i++) 
#define repb(i,a,b) for (int i=a;i>=b;i--)
typedef pair < int , int > pr; typedef pair < pr  , int > prr;
#define L first
#define R second
template <class T> inline bool checkMin(T& a , T b) { return (a > b ? a=b,1 : 0); }
template <class T> inline bool checkMax(T& a , T b) { return (a < b ? a=b,1 : 0); }
class Scanner{ private: istream& ist;public: Scanner(istream& in):ist(in){} string next(){ string r; ist >> r; return r; } string nextLine(){ string r; getline(ist,r); return r; } int nextInt(){ int r; ist >> r; return r; } double nextDouble(){ double r; ist >> r; return r; } char nextChar(){ char r; ist>>r; return r;} }; Scanner sc(cin);
void ALERT(bool judgememt, const char* phrase) { if (judgememt) { puts(phrase); throw "ALERT"; } }
bool alert(bool judgememt, const char* phrase) { if (judgememt) puts(phrase); return judgememt; }
#define ll long long
const int N=400010;
const int mod=200003;
const int G=11;
using namespace std;
ll num[N],cnt[N],_11[N];
const double pi=acos(-1);
struct xu{
	double s,x;
	xu(double S=0.0,double X=0.0):s(S),x(X){};
	xu operator +(const xu a){return xu(s+a.s,x+a.x);}
	xu operator -(const xu a){return xu(s-a.s,x-a.x);}
	xu operator *(const xu a){return xu(s*a.s-x*a.x,s*a.x+x*a.s);}
};

inline void fft(xu a[],int n,int len)
{
	int rev[n];
	rev[0]=0;
	for(register int i=1;i<n;i++)
	{
		rev[i]=(rev[i>>1]>>1)|((i&1)<<(len-1));
		if(rev[i]>i) swap(a[rev[i]],a[i]);
	}
	for(register int i=1;i<n;i<<=1)
	{
		xu omg(cos(pi/i),sin(pi/i));
		for(int j=0;j<n;j+=i*2)
		{
			xu orz(1,0);
			for(int k=0;k<i;k++)
			{
				xu n1=a[j+k],n2=orz*a[i+k+j];
				a[j+k]=n1+n2;
				a[i+j+k]=n1-n2;
				orz=orz*omg;
			}
		}
	}
}
inline void nfft(xu a[],int n,int len)
{
	int rev[n];
	rev[0]=0;
	for(int i=1;i<n;i++)
	{
		rev[i]=(rev[i>>1]>>1)|((i&1)<<(len-1));
		if(rev[i]>i) swap(a[rev[i]],a[i]);
	}
	for(int i=1;i<n;i<<=1)
	{
		xu omg(cos(pi/i),-sin(pi/i));
		for(int j=0;j<n;j+=i*2)
		{
			xu orz(1,0);
			for(int k=0;k<i;k++)
			{
				xu n1=a[j+k],n2=orz*a[i+k+j];
				a[j+k]=n1+n2;
				a[i+j+k]=n1-n2;
				orz=orz*omg;
			}
		}
	}
	for(int i=0;i<n;i++) {
		a[i].s=a[i].s/n;
		a[i].x=a[i].x/n;
	}
}
xu f[mod*4];
int main()
{
    int n;
    ll s=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%lld",&num[i]);
    _11[0]=1;
    for(int i=1;i<=mod-2;i++)
    {
        _11[i]=1ll*_11[i-1]*G%mod;
        cnt[_11[i]]=i;
    }
    int m=1,l=0;
    while(m<=mod*2) m=m*2,l++;
    for(int i=1;i<=n;i++)
    if(num[i])f[cnt[num[i]]].s++;
    fft(f,m,l);
    for(int i=0;i<m;i++) f[i]=f[i]*f[i];
    nfft(f,m,l);
    // for(int i=0;i<m;i++)
    // if((ll)(f[i].s+0.5)) printf("%d:%d - %d\n",i,_11[i%mod],(ll)(f[i].s+0.5));
    ll ans=0;
    for(int i=0;i<mod*2;i++)
        ans+=1ll*_11[i%(mod-1)]*(ll)(f[i].s+0.5);
    for(int i=1;i<=n;i++) ans-=1ll*num[i]*num[i]%mod;
    ans/=2;
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 23340