#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;

#ifdef LOCAL
#define Gene template< class
#define Rics printer& operator,
Gene c> struct rge{c b, e;};
Gene c> rge<c> range(c i, c j){ return {i, j};}
struct printer{
    ~printer(){cerr<<endl;}
    Gene c >Rics(c x){ cerr<<boolalpha<<x; return *this;}
    Rics(string x){cerr<<x;return *this;}
    Gene c, class d >Rics(pair<c, d> x){ return *this,"(",x.first,", ",x.second,")";}
    Gene ... d, Gene ...> class c >Rics(c<d...> x){ return *this, range(begin(x), end(x));}
    Gene c >Rics(rge<c> x){
        *this,"["; for(auto it = x.b; it != x.e; ++it)
            *this,(it==x.b?"":", "),*it; return *this,"]";}
};
#define debug() cerr<<"LINE "<<__LINE__<<" >> ", printer()
#define dbg(x) "[",#x,": ",(x),"] "
#define bits(x) bitset<22>(x)
#define tham getchar()
#endif

#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define eq(x, y) (fabs((x)-(y))<error)
#define bt(i) (1LL<<(i))

mt19937_64 rng((unsigned)chrono::system_clock::now().time_since_epoch().count());
const ll mod = 200003;
//const ld error = ;
const ld PI = acosl(-1);

//inline ll MOD(ll x, ll m = mod){
//    ll y = x % m;
//    return (y >= 0) ? y: y+m;
//}

//const int/ll inf = ;
const int nmax = 2e5+10;
///===========================================  template  =======================================================

int two[nmax], inv[nmax], cnt[nmax];


typedef complex<double> T;
typedef vector<T> poly;
poly roots;					//precomputed roots
int N;						//size of stored roots
void precal(int n){			//n MUST BE power of 2, >= 2*nmax
    N = n;
    roots.resize(n+1);
    double tmp = 2.0*PI/n, ang = 0;
    for(int i = 0; i<=n; i++, ang += tmp)
        roots[i] = polar(1.0, ang);
}

#define nxt(i, m) ( (i)^m^(bt( 31-__builtin_clz((i)^m) )-1) )
//^this returns next to i after reversing w.r.t mask m

void FFT(poly &coefs, poly &values, bool invert = false)	//invert -> inverse DFT
{
    int n = coefs.size(), lg_n = __builtin_ctz(n), mask = bt(lg_n) - 1;;
    values.resize(n);		//coefs MUST BE of size 2^k

    for(int i = 0, j = 0; j<n; j++, i = nxt(i, mask))
        values[j] = coefs[i];			//filling values with ordered coefficients

    for(int len = 2, hlen = 1; len<=n; len<<=1, hlen<<=1){		//recursions from base level
        double deltheta = 2*PI/len;
        if(invert) deltheta = -deltheta;
        for(int i = 0; i<n; i+=len){			//each part in a level
            double theta = 0;
            for(int j = 0, r = N/len; j < hlen; j++, theta += deltheta){	//the recursion
                T w = polar(1.0, theta);//(invert)? roots[N-j*r] : roots[j*r];
                T u = values[i+j], v = values[i+j+hlen]*w;
                values[i+j] = u + v;
                values[i+j+hlen] = u - v;
            }
        }
    }
    if(invert) for(auto &x: values) x /= n;		//final division if inverting
}

void multiply(poly &A, poly &B, poly &C)	//result is stored in C
{
    poly va, vb;
    int a = A.size(), b = A.size(), n = 1;
    while(n < a + b) n <<= 1;
    A.resize(n);		//making polynomials large enough

    FFT(A, va);			//NTT
    for(int i = 0; i<n; i++)  va[i] *= va[i];	//mod if NTT
    FFT(va, C, true);				//NTT inverse

    A.resize(a);		//returning back to original size
    C.resize(a+b-1);
}

int main(){
    FASTIO;

    precal(1<<20);

    for(int i = 0, now = 1; i<mod-1; i++, now = 2*now % mod){
        inv[now] = i;
        two[i] = now;
    }

    int n;
    cin>>n;
    ll extra = 0;
    for(int i = 0; i<n; i++){
        int x;
        cin>>x;
        if(x == 0) continue;
        extra += ll(x)*ll(x) % mod;
        x = inv[x];
        cnt[x]++;
    }

    poly A(mod-1), B;
    for(int i = 0; i<mod-1; i++) A[i] = cnt[i];

    multiply(A, A, B);


    ll ans = 0;
    for(int i = 0; i<=2*(mod-2); i++){
        int e = i % (mod-1);
        ll c = llround(B[i].real());

        ans += two[e]*c;
    }

    ans -= extra;
    ans /= 2;

    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 47064