///****In the name of ALLAH, most Gracious, most Compassionate****//

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair <int, int> pii;

#define ALL(a) a.begin(), a.end()
#define FastIO ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define IN freopen("input.txt","r+",stdin)
#define OUT freopen("output.txt","w+",stdout)

#define DBG(a) cerr<< "line "<<__LINE__ <<" : "<< #a <<" --> "<<(a)<<endl
#define NL cout<<endl

template < class T1,class T2>
ostream &operator <<(ostream &os,const pair < T1,T2 > &p)
{
    os<<"{"<<p.first<<","<<p.second<<"}";
    return os;
}

const int N=2e5+5;
const int oo=1e9+7;

#define PI 3.14159265359
typedef long long LL;
typedef complex<double> base;

void fft (vector<base> & a, bool invert) {
    int n = (int) a.size();

    for (int i=1, j=0; i<n; ++i) {
        int bit = n >> 1;
        for (; j>=bit; bit>>=1)
            j -= bit;
        j += bit;
        if (i < j)
            swap (a[i], a[j]);
    }

    for (int len=2; len<=n; len<<=1) {
        double ang = 2*PI/len * (invert ? -1 : 1);
        base wlen (cos(ang), sin(ang));
        for (int i=0; i<n; i+=len) {
            base w (1);
            for (int j=0; j<len/2; ++j) {
                base u = a[i+j],  v = a[i+j+len/2] * w;
                a[i+j] = u + v;
                a[i+j+len/2] = u - v;
                w *= wlen;
            }
        }
    }
    if (invert)
        for (int i=0; i<n; ++i)
            a[i] /= n;
}

void multiply (const vector<LL> & a, const vector<LL> & b, vector<LL> & res) {
    vector<base> fa (a.begin(), a.end()),  fb (b.begin(), b.end());
    size_t n = 1;
    while (n < max (a.size(), b.size()))  n <<= 1;
    n <<= 1;
    fa.resize (n),  fb.resize (n);

    fft (fa, false),  fft (fb, false);
    for (size_t i=0; i<n; ++i)
        fa[i] *= fb[i];
    fft (fa, true);

    res.resize (n);
    for (size_t i=0; i<n; ++i)
        res[i] = LL (fa[i].real() + 0.5);
}



int powmod (int a, int b, int p) {
    int res = 1;
    while (b)
        if (b & 1)
            res = int (res * 1ll * a % p),  --b;
        else
            a = int (a * 1ll * a % p),  b >>= 1;
    return res;
}

int generator (int p) {
    vector<int> fact;
    int phi = p-1,  n = phi;
    for (int i=2; i*i<=n; ++i)
        if (n % i == 0) {
            fact.push_back (i);
            while (n % i == 0)
                n /= i;
        }
    if (n > 1)
        fact.push_back (n);

    for (int res=2; res<=p; ++res) {
        bool ok = true;
        for (size_t i=0; i<fact.size() && ok; ++i)
            ok &= powmod (res, phi / fact[i], p) != 1;
        if (ok)  return res;
    }
    return -1;
}

int paw[N];
int lg[N];

int32_t main()
{
    FastIO;
    int p = 2e5+3;
    int g = generator(p);
//    DBG(g);
    paw[0] = 1;
    lg[1] = 0;
    for(int i=1;i<p;i++)
    {
        paw[i] = (paw[i-1] * g)  % p;
        assert(lg[paw[i]] == 0);
        lg[paw[i]] = i;
    }
//    DBG(lg[0]);

    vector<LL > cnt(p , 0);

    ll ans = 0;

    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        if(a)
        {


            ans -= (a * 1LL * a) % p;
//            DBG((a * 1LL * a) % p);

            int x=a;
            a= lg[a];
//            DBG(a);
//            assert(powmod(g,a,p) == paw[a]);
            cnt[a] ++;
        }
    }


    vector<LL > res;
    multiply(cnt , cnt , res);



    for(int i=0;i<res.size();i++)
    {
//        if(res[i])
//        {
//            DBG(i);
//            DBG(i%p);
//            DBG(res[i]);
//            DBG(paw[i%(p-1)]);
//            NL;
//        }
        ans += res[i] * paw[i%(p-1)];
    }
    ans/=2;

    cout<<ans<<"\n";


}


Measured memory_bytes: 27156