#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define st first
#define nd second
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
template <class T> T read(T &a) {
    a=0;char x=getchar();bool f=0;
    for(;x<'0'||x>'9';x=getchar())f|=x=='-';
	for(;x>='0'&&x<='9';x=getchar())a=(a<<3)+(a<<1)+x-'0';
    if(f)a=-a;
    return a;
}
using namespace std;

class FFT {
    private:
        struct C {
            double r, i;
            C() {}
            C(double a, double b) {r = a, i = b;}
            C operator + (C x) {return C(r + x.r, i + x.i);}
            C operator - (C x) {return C(r - x.r, i - x.i);}
            C operator * (C x) {return C(r * x.r - i * x.i, r * x.i + i * x.r);}
        };
        const double PI = acos(-1.0);
        vector<C> a, b, w;
        vector<int> R;
        int n, L, A, B;
    public:
        void fft(vector<C> &a){
            for (int i = 0; i < n; ++i) {
                if (R[i] > i) {
                    swap(a[R[i]], a[i]);
                }
            }
            for (int t = n >> 1, d = 1; d < n; d <<= 1, t >>= 1) {
                for (int i = 0; i < n; i += (d << 1)) {
                    for (int j = 0; j < d; ++j) {
                        C tmp = w[t * j] * a[i + j + d];
                        a[i + j + d] = a[i + j] - tmp;
                        a[i + j] = a[i + j] + tmp;
                    }
                }
            }
        }
        void init(vector<LL> c, vector<LL> d) {
            A = c.size(), B = d.size();
            for (n = 1, L = 0; n <= A + B; n <<= 1, ++L);
            a.resize(n), b.resize(n), w.resize(n), R.resize(n);
            for (int i = 0; i < A; ++i) {
                a[i].r = c[i];
                a[i].i = 0; 
            }
            for (int i = 0; i < B; ++i) {
                b[i].r = d[i];
                b[i].i = 0;
            }
            R[0] = 0;
            for (int i = 0; i < n; ++i) {
                R[i] = (R[i >> 1] >> 1) | ((i & 1) << (L - 1));
                w[i] = C(cos(2.0 * i * PI / n), sin(2.0 * i * PI / n));
            }
        }
        vector<LL> run() {
            fft(a);
            fft(b);
            for (int i = 0; i < n; i++) {
                a[i] = a[i] * b[i];
                w[i].i = -w[i].i;
            }
            fft(a);
            A--, B--;
            vector<LL> ans;
            for (int i = 0;i <= A + B; ++i) {
                ans.push_back((LL)(a[i].r / n + 0.5));
            }
            return ans;
        }
};

const int MOD = 200003;

int a[MOD], mp[MOD + 5], num[MOD + 5], n;
LL b[MOD];
vector<LL> cnt(MOD), ans;
FFT fun;

int main() {
    for (int i = 0, j = 1; i < MOD - 1; j = (j << 1) % MOD, i++) {
        mp[i] = j;
        num[mp[i]] = i;
    }
    read(n);
    for (int i = 1; i <= n; ++i) {
        read(a[i]);
        if (a[i]) cnt[num[a[i]]]++;
    }
    fun.init(cnt, cnt);
    ans = fun.run();
    for (int i = 0; i < ans.size(); ++i) {
        b[mp[i % (MOD - 1)]] += ans[i];
    }
    for (int i = 1; i <= n; ++i) {
        b[((LL)a[i] * a[i]) % MOD]--;
    }
    LL tot = 0;
    for (int i = 1; i < MOD; ++i) {
        tot += b[i] / 2 * i;
    }
    cout << tot << endl;
	return 0;
}


Measured memory_bytes: 40768