#include<iostream>
#include<complex>
#include<vector>
#include<cmath>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
typedef complex<double>cp;
const int inf=1e9+7;
const ll INF=1e18;
const int mod=200003;
const int pr=2;
typedef double ld;
typedef complex<double>cp;
const double mpi=acos(-1);
const int siz=512;
inline void fft(vector<cp>&v,bool inv)
{
    int i,j;
    int n=v.size();
    for(i=1,j=0;i<n;i++)
    {
        int bit=n/2;
        while((j&bit)>0)
            j-=bit,bit/=2;
        j+=bit;
        if(j>i)
            swap(v[i],v[j]);
    }
    vector<cp>rt;
    ld an=acos(-1)*2/n*(inv?1:-1);
    for(i=0;i<n/2;i++)
        rt.eb(cos(an*i),sin(an*i));
    for(i=2;i<=n;i*=2)
    {
        for(j=0;j<n;j+=i)
        {
            for(int k=0;k<i/2;k++)
            {
                cp t=v[j+k+i/2]*rt[n/i*k];
                v[j+k+i/2]=v[j+k]-t;
                v[j+k]+=t;
            }
        }
    }
    if(inv)
        for(i=0;i<n;i++)
            v[i]/=n;
    return;
}
inline ll rnd(ld x)
{
    return x<0?(ll)-(-x+0.5):(ll)(x+0.5);
}
inline vector<ll>mult(const vector<ll>&x,const vector<ll>&y)
{
    int n=1;
    while(n<(int)x.size()+(int)y.size())
        n*=2;
    vector<cp>i1(n),i2(n),o1(n),o2(n);
    int i;
    for(i=0;i<(int)x.size();i++)
        i1[i]=cp(x[i]/siz,x[i]%siz);
    for(i=0;i<(int)y.size();i++)
        i2[i]=cp(y[i]/siz,y[i]%siz);
    fft(i1,false);
    fft(i2,false);
    for(i=0;i<n;i++)
    {
        int j=i==0?0:n-i;
        cp a1=(i1[i]+conj(i1[j]))*cp(0.5,0);
        cp a2=(i1[i]-conj(i1[j]))*cp(0,-0.5);
        cp a3=(i2[i]+conj(i2[j]))*cp(0.5,0);
        cp a4=(i2[i]-conj(i2[j]))*cp(0,-0.5);
        o1[i]=a1*a3+a1*a4*cp(0,1);
        o2[i]=a2*a3+a2*a4*cp(0,1);
    }
    fft(o1,true);
    fft(o2,true);
    vector<ll>ans(n);
    for(i=0;i<n;i++)
    {
        ll a1=rnd(o1[i].real());
        a1=a1*siz;
        a1+=rnd(o1[i].imag())+rnd(o2[i].real());
        a1=a1*siz;
        a1+=rnd(o2[i].imag());
        ans[i]=a1;
    }
    while(ans.size()>1&&ans.back()==0)
        ans.pop_back();
    return ans;
}
inline int add(int x,int y)
{
    return x+y<mod?x+y:x+y-mod;
}
inline int mul(int x,int y)
{
    return(int)((ll)x*y%mod);
}
inline int pw(int x,int y)
{
    int ans=1;
    while(y>0)
    {
        if(y%2==1)
            ans=mul(ans,x);
        x=mul(x,x);
        y/=2;
    }
    return ans;
}
int cnt[200010];
int pwp[200010],rev[200010];
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    vector<int>v(n);
    vector<ll>ct(mod-1,0);
    for(int i=0,cur=1;i<mod-1;i++)
        rev[pwp[i]=cur]=i,cur=mul(cur,pr);
    for(int&t:v)
    {
        cin>>t;
        if(t!=0)
            ct[rev[t]]++;
    }
    vector<ll>ct2=ct;
    vector<ll>ans=mult(ct,ct2);
    for(int&t:v)
        if(t!=0)
            ans[rev[t]*2]--;
    for(ll&t:ans)
        t/=2;
    ll rans=0;
    for(int i=0;i<(int)ans.size();i++)
        rans+=ans[i]*pwp[i%(mod-1)];
    cout<<rans<<endl;
    return 0;
}

Measured memory_bytes: 50072