#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b);
#define chmin(a, b) a = min(a, b);
using namespace std;
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;

struct MyClx {
    double real, imag;
    MyClx(double x, double y):real(x),imag(y){}
    MyClx():real(0),imag(0){}
    template<class T> MyClx(T x):real(x),imag(0){}
    MyClx operator+(const MyClx& z) const {return MyClx(real+z.real,imag+z.imag);}
    MyClx operator-(const MyClx& z) const {return MyClx(real-z.real,imag-z.imag);}
    MyClx operator*(const MyClx& z) const {return MyClx(real*z.real-imag*z.imag,real*z.imag+imag*z.real);}
    MyClx operator/(const MyClx& z) const {
        double t=z.real*z.real+z.imag*z.imag;
        return MyClx((real*z.real+imag*z.imag)/t,(imag*z.real-real*z.imag)/t);
    }
    MyClx& operator+=(const MyClx& z){real+=z.real;imag+=z.imag;return *this;}
    MyClx& operator-=(const MyClx& z){real-=z.real;imag-=z.imag;return *this;}
    MyClx& operator*=(const MyClx& z){
        double nr=real*z.real-imag*z.imag;
        double ni=real*z.imag+imag*z.real;
        real=nr; imag=ni; return *this;
    }
    MyClx& operator/=(const MyClx& z){
        double t=z.real*z.real+z.imag*z.imag;
        double nr=(real*z.real+imag*z.imag)/t;
        double ni=(imag*z.real-real*z.imag)/t;
        real=nr; imag=ni; return *this;
    }
    template<class T>MyClx& operator/=(const T z){real/=z;imag/=z;return *this;}
};

std::vector<MyClx> fft(const std::vector<MyClx>& a) {
    const int n = a.size();
    if (n == 1) return a;
    const int n2 = n / 2;
    std::vector<MyClx> a_even(n2), a_odd(n2);
    for(int i = 0; i < n2; i+=1) {
        a_even[i] = a[i*2];
        a_odd[i]  = a[i*2+1];
    }
    auto f_even = fft(a_even), f_odd = fft(a_odd);
    std::vector<MyClx> f(n);
    MyClx zeta(cos(2*M_PI/n), sin(2*M_PI/n));
    MyClx x(1,0);
    for(int i = 0; i < n2; i++) {
        f[i] = f_even[i] + x * f_odd[i];
        f[i+n2] = f_even[i] - x * f_odd[i];
        x *= zeta;
    }
    return f;
}

template<class T> std::vector<MyClx> fft(const std::vector<T>& a) {
    int sz = a.size();
    std::vector<MyClx> a2(sz);
    for(int i = 0; i < sz; i++) {
        a2[i].real = a[i];
        a2[i].imag = 0;
    }
    return fft(a2);
}

std::vector<MyClx> ifft(std::vector<MyClx> a) {
    const int n = a.size();
    if (n == 1) return a;
    const int n2 = n / 2;
    std::vector<MyClx> a_even(n2), a_odd(n2);
    for(int i = 0; i < n2; i+=1) {
        a_even[i] = a[i*2];
        a_odd[i]  = a[i*2+1];
    }
    auto f_even = ifft(a_even), f_odd = ifft(a_odd);
    std::vector<MyClx> f(n);
    MyClx zeta(cos(2*M_PI/n), -sin(2*M_PI/n));
    MyClx x(1,0);
    for(int i = 0; i < n2; i++) {
        f[i] = f_even[i] + x * f_odd[i];
        f[i+n2] = f_even[i] - x * f_odd[i];
        x *= zeta;
    }
    return f;
}

std::vector<MyClx> ifft_wrapper(const std::vector<MyClx>& a) {
    auto f = ifft(a);
    int sz = f.size();
    for(int i = 0; i < sz; i++) f[i] /= sz;
    return f;
}

int main() {
    int p = 200003;
    /*rep(i, p) {
        bool seen[p] = {};
        bool ok = true;
        int now = 1;
        rep(j, p-1) {
            if (seen[now]) {
                ok = false;
                break;
            }
            seen[now] = true;
            now = now * i % p;
        }
        if (ok) {
            cout << i << endl;
            return 0;
        }
    }*/
    // a = 2
    VI toX(p), toO(p-1);
    // 8 -> 3  3 -> 8
    {
        int now = 1;
        rep(i, p-1) {
            toX[now] = i;
            toO[i] = now;
            now = now * 2 % p;
        }
    }
    int n;
    cin >> n;
    int p2 = 1;
    while(!((p-2) * 2 < p2)) p2 *= 2;
    VI c(p2);
    ll ans = 0;
    rep(i, n) {
        int ai;
        cin >> ai;
        if (ai == 0) continue;
	ans -= (ll)ai * ai % p;
        c[toX[ai]] += 1;
    }
    vector<MyClx> fc = fft(c);
    rep(i, p2) fc[i] *= fc[i];
    auto cconv = ifft_wrapper(fc);
    rep(i, p2) {
        int  a = toO[i % (p-1)];
	ll cnt = cconv[i].real+0.5;
        ans += a * cnt;
    }
    cout << ans/2 << endl;
}

Measured memory_bytes: 56972