#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
//#define inf 2000000000
#define inf 8000000000000000000
//#define pi 3.14159265358979323846264338328
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#define ykh mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a)
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;

inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=200005,p=200003;
//i_am_noob
int n,a[maxn],cnt[maxn]={0},powg[maxn],revg[maxn],x,cnt2[maxn]={0},ans=0;

template <typename T>
struct cpx{
    T x,y;
    cpx(){x=y=0;}
    cpx(T _x){x=_x,y=0;}
    cpx(T _x, T _y){x=_x,y=_y;}
    cpx<T> operator +(const cpx& o) const {return cpx(x+o.x,y+o.y);}
    cpx<T> operator *(const cpx& o) const {return cpx(x*o.x-y*o.y,x*o.y+y*o.x);}
};

template <typename T>
struct FFT{
    int siz;
    vector<T> rt,rev_rt;
    FFT(int _siz){
        siz=_siz;
        ld pi=acos(-1);
        rep(pow2(_siz)) rt.pb(T(cos(2*pi*i/pow2(siz)),sin(2*pi*i/pow2(siz))));
        rep(pow2(_siz)) rev_rt.pb(i?rt[pow2(_siz)-i]:1);
    }
    void mul_matrix(vector<T>& vec, vector<T>& RT){
        while(sz(vec)<pow2(siz)) vec.pb(T(0));
        int rev=0;
        rep(pow2(siz)){
            if(i>rev) swap(vec[i],vec[rev]);
            for(int j=pow2(siz-1); (rev^=j)<j; j>>=1);
        }
        T tmp1,tmp2;
        rep2(layer,1,siz+1){
            for(int i=0; i<pow2(siz); i+=pow2(layer)){
                for(int j=i; j<i+pow2(layer-1); j++){
                    tmp1=vec[j],tmp2=RT[(j-i)*pow2(siz-layer)]*vec[j+pow2(layer-1)];
                    vec[j]=tmp1+tmp2;
                    vec[j+pow2(layer-1)]=tmp1+tmp2*cpx<ld>(-1,0);
                }
            }
        }
    }
    void mul(vector<T>& vec1, vector<T>& vec2, vector<T>& ans){
        mul_matrix(vec1,rt),mul_matrix(vec2,rt);
        while(sz(ans)<pow2(siz)) ans.pb(T(0));
        rep(pow2(siz)) ans[i]=vec1[i]*vec2[i];
        mul_matrix(ans,rev_rt);
        rep(pow2(siz)) ans[i]=ans[i]*T(1.0/pow2(siz));
    }
};
FFT<cpx<ld>> fft(19);
vector<cpx<ld>> P,Q,R;

signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin >> n;
    rep(n){
        cin >> a[i];
        cnt[a[i]]++;
    }
    powg[0]=1,revg[1]=0;
    x=1;
    rep(p-2){
        x=x*2%p;
        powg[i+1]=x,revg[x]=i+1;
    }
    rep(p-1) P.pb(cnt[powg[i]]),Q.pb(cnt[powg[i]]);
    fft.mul(P,Q,R);
    rep(2*p) cnt2[powg[i%(p-1)]]+=(int)round(R[i].x);
    rep(p-1) ans+=powg[i]*cnt2[powg[i]];
    rep(n) ans-=a[i]*a[i]%p;
    print1(ans/2);
    return 0;
}


Measured memory_bytes: 100060