//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

template<typename T>
class Complex{
public:
	T re,im;
	Complex():re{0.0},im{0.0}{}
	Complex(T re_in,T im_in):re{re_in},im{im_in}{}
	Complex operator+(Complex const &rhs)const{
		return Complex{re+rhs.re,im+rhs.im};
	}
	Complex operator-(Complex const &rhs)const{
		return Complex{re-rhs.re,im-rhs.im};
	}
	Complex operator*(Complex const &rhs)const{
		return Complex{re*rhs.re-im*rhs.im,re*rhs.im+im*rhs.re};
	}
};

template<typename T>
class FFT{
public:
	T pie=acos(-1.0);
    int sz;
    Complex<T> lt,rt;
    vector<Complex<T>> f,g,fgd,zeta,c;
	vector<ll> fg;

    // nr sz乗根
    FFT(const vector<ll>& a,const vector<ll>& b):sz{(int)a.size()+(int)b.size()}{
        f.assign((int)a.size(),Complex<T>{});
        g.assign((int)b.size(),Complex<T>{});
        rep(i,(int)a.size()) f[i]=Complex<T>{(T)a[i],0.0};
        rep(i,(int)b.size()) g[i]=Complex<T>{(T)b[i],0.0};
        int n=1;
        while(n<sz) n*=2;
        sz=n;

        zeta.assign(sz,Complex<T>{});
        fgd.assign(sz,Complex<T>{});
        c.assign(sz,Complex<T>{});
		fg.assign(sz,0);
        for(int i=0;i<sz;i++) zeta[i]=Complex<T>{cos(2.0*pie/sz*i),sin(2.0*pie/sz*i)};
        dft_f(0,sz,0,0);
        dft_g(0,sz,0,0);
        idft(0,sz,0,0);
    }

    //dft(0,sz,0,0);
    void dft_f(int a,int len,int k,int idx){
        if(len==1){
            c[a]=Complex<T>{};
            if(idx<f.size()) c[a]=f[idx];
            return;
        }
        dft_f(a,len>>1,k+1,idx);
        dft_f(a+(len>>1),len>>1,k+1,idx+(1<<k));
        rep(i,len>>1){
            lt=c[a+i%(len>>1)]; rt=c[a+i%(len>>1)+(len>>1)];
            c[a+i]=lt+zeta[sz/len*i]*rt;
            c[a+i+(len>>1)]=lt+zeta[sz/len*i+(sz>>1)]*rt;
        }
        if(k==0)rep(i,sz) fgd[i]=c[i];
    }

    //dft(0,sz,0,0);
    void dft_g(int a,int len,int k,int idx){
        if(len==1){
            c[a]=Complex<T>{};
            if(idx<g.size()) c[a]=g[idx];
            return;
        }
        dft_g(a,len>>1,k+1,idx);
        dft_g(a+(len>>1),len>>1,k+1,idx+(1<<k));
        rep(i,len>>1){
            lt=c[a+i%(len>>1)]; rt=c[a+i%(len>>1)+(len>>1)];
            c[a+i]=lt+zeta[sz/len*i]*rt;
            c[a+i+(len>>1)]=lt+zeta[sz/len*i+(sz>>1)]*rt;
        }
        if(k==0)rep(i,sz) fgd[i]=fgd[i]*c[i];
    }

    //idft(0,sz,0,0);
    void idft(int a,int len,int k,int idx){
        if(len==1){
            c[a]=fgd[idx];
            return;
        }
        idft(a,len>>1,k+1,idx);
        idft(a+(len>>1),len>>1,k+1,idx+(1<<k));
        rep(i,len>>1){
            lt=c[a+i%(len>>1)]; rt=c[a+i%(len>>1)+(len>>1)];
            c[a+i]=lt+zeta[(sz-(sz/len*i))%sz]*rt;
            c[a+i+(len>>1)]=lt+zeta[((sz>>1)-(sz/len*i))%sz]*rt;
        }
        if(k==0){
			rep(i,sz){
				c[i]=c[i]*Complex<T>{1.0/sz,0.0};
				fg[i]=(ll)(c[i].re+0.5);
			}
		}
    }

    void print(const vector<ll>& v){
        rep(i,v.size()) cout<<v[i]<<" ";
        cout<<endl;
    }
};

int main(){
    ll n,ans=0; cin>>n;
    vector<ll> cnt(200003,0),lg(200003,0),pw(200003,0);
    ll cur=1;
    rep(i,200002){
        if(lg[cur]!=0) cout<<"!"<<endl;
        lg[cur]=i;
        pw[i]=cur;
        cur=cur*2%200003;
    }
    rep(i,n){
        ll a; cin>>a;
        if(a>0) cnt[lg[a]]++;
        ans-=a*a%200003;
    }
    FFT<double> fft{cnt,cnt};
    rep(i,2*200003){
        ans+=fft.fg[i]*pw[i%200002];
    }
    cout<<ans/2<<endl;
}

Measured memory_bytes: 42844