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

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define MOO(i, a, b) for(int i=a; i<b; i++)
#define M00(i, a) for(int i=0; i<a; i++)
#define MOOd(i,a,b) for(int i = (b)-1; i >= a; i--)
#define M00d(i,a) for(int i = (a)-1; i>=0; i--)

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << '\n', 0;
#define dbg(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " _ " <<

template<class T> bool ckmin(T& a, const T& b) {return b < a ? a = b, 1 : 0;}
template<class T> bool ckmax(T& a, const T& b) {return a < b ? a = b, 1 : 0;}

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ld,ld> pd;
typedef complex<ld> cd;
typedef vector<cd> vcd;

namespace FFT {
    int getsz(int n) { // smallest i such that 2^i >= n
        return n > 1 ? 32 - __builtin_clz(n - 1) : 0;
    }
    int rev(int s, int k) { // reverse bits
        int res = 0;
        M00(i, s) if(k&(1<<i)) res += (1<<(s-i-1));
        return res;
    }
    vcd DFT(vcd& a) {
        int n = (int)a.size(); int s = getsz(n);
        vcd A(n); M00(i, n) A[rev(s, i)] = a[i];

        MOO(i, 1, s+1) {
            int m = (1<<i);
            cd wm = cd(cos(2*M_PI/m), sin(2*M_PI/m));
            for(int j = 0; j < n; j += m) {
                cd w = cd(1, 0);
                M00(k, m/2) {
                    cd t = w*A[j+k+m/2];
                    cd u = A[j+k];
                    A[j+k] = u+t;
                    A[j+k+m/2] = u-t;
                    w *= wm;
                }
            }
        }
        return A;
    }
    vcd iDFT(vcd& a) {
        vcd A = DFT(a);
        for(cd& c: A) c /= A.size();
        reverse(A.begin()+1, A.end()); // replace w by w^(-1) so i goes to (-i)%n
        return A;
    }
    vcd brute(vcd& a, vcd& b) {
        vcd res((int)a.size()+(int)b.size()-1);
        M00(i, (int)a.size()) M00(j, (int)b.size()) res[i+j] += a[i]*b[j];
        return res;
    }
    vcd conv(vcd a, vcd b) {
        int o = (int)a.size()+(int)b.size()-1; int s = getsz(o); int n = (1<<s);
        if(o <= 200) return brute(a, b);
        a.resize(n); b.resize(n); vcd A = DFT(a); vcd B = DFT(b);
        vcd res = vcd(n);
        M00(i, n) res[i] = A[i] * B[i];
        res = iDFT(res); res.resize(o);
        return res;
    }
    vector<ll> conv(vector<ll> a, vector<ll> b) {
        vcd A; for(ll v: a) A.pb(cd(v, 0));
        vcd B; for(ll v: b) B.pb(cd(v, 0));
        vcd r = conv(A, B);
        vector<ll> res; for(cd v: r) res.pb(round(v.real()));
        return res;
    }
}

const ll P = 200003;
const int MAX_N = 200010;
int n;
ll arr[MAX_N];
int arrG[MAX_N];
int pow2[MAX_N];
int idx[P]; // 2^idx[i] = i (mod P)

int main() { FAST
    cin >> n;
    int ctr = 0;
    M00(i, n) {
        int x; cin >> x;
        if(x != 0) arr[ctr++] = x;
    }
    n = ctr;
    pow2[0] = 1;
    MOO(i, 1, MAX_N) pow2[i] = (pow2[i-1]*2)%P;
    ll cur = 1;
    M00(i, P-1) {
        idx[cur] = i;
        cur *= 2; cur %= P;
    }
    M00(i, n) arrG[i] = idx[arr[i]];
    vector<ll> v(P-1, 0);
    M00(i, n) v[arrG[i]]++;
    vector<ll> v2 = FFT::conv(v,v);
    while(sz(v2) >= P) {
        int idx = (sz(v2)-1)%(P-1);
        v2[idx] += v2.back();
        v2.pop_back();
    }
    ll res = 0;
    M00(i, sz(v2)) {
        res += pow2[i]*v2[i];
    }
    M00(i, n) {
        res -= (arr[i]*arr[i])%P;
    }
    res /= 2LL;
    finish(res);
}



Measured memory_bytes: 123124