#include <cstdio>
#include <vector>

using namespace std;

template <int MOD> class ntt {
    public:
    constexpr ntt();
    constexpr int inv(int x) const;
    vector<int> convolute(const vector<int>& a, const vector<int>& b) const;
    
    private:
    int w[30];
    int iw[30];
    constexpr int pow(int x, int y) const;
    void transform(vector<int>& a, bool inverse = false) const;
};

template <int MOD> constexpr ntt<MOD>::ntt() : w(), iw() {
    int n = __builtin_ctz(MOD - 1);
    int root = 2;
    while (pow(root, (MOD - 1) >> 1) == 1) root++;
    for (int i = 0; i < n; i++) w[i] = MOD - pow(root, (MOD - 1) >> (i + 2));
    for (int i = 0; i < n; i++) iw[i] = inv(w[i]);
}

template <int MOD> constexpr int ntt<MOD>::pow(int x, int y) const {
    int z = 1;
    while (y) {
        if (y & 1) z = (long long)z * x % MOD;
        x = (long long)x * x % MOD;
        y >>= 1;
    }
    return z;
}

template <int MOD> constexpr int ntt<MOD>::inv(int x) const {
    int y = MOD, a = 1, b = 0;
    while (y) {
        int t = x / y;
        x -= t * y;
        a -= t * b;
        x ^= y;
        y ^= x;
        x ^= y;
        a ^= b;
        b ^= a;
        a ^= b;
    }
    a %= MOD;
    if (a < 0) a += MOD;
    return a;
}

template <int MOD> void ntt<MOD>::transform(vector<int>& a, bool inverse) const {
    int n = a.size();
    if (!inverse) {
        for (int sz = n >> 1; sz >= 1; sz >>= 1) {
            long long e = 1;
            for (int i = 0, j = 1; i < n; i += sz * 2, j++) {
                for (int l = i, r = i + sz; l < i + sz; l++, r++) {
                    int x = a[l], y = a[r] * e % MOD;
                    a[l] = x + y;
                    if (a[l] >= MOD) a[l] -= MOD;
                    a[r] = x - y;
                    if (a[r] < 0) a[r] += MOD;
                }
                e = e * w[__builtin_ctz(j)] % MOD;
            }
        }
    } else {
        for (int sz = 1; sz < n; sz <<= 1) {
            long long e = 1;
            for (int i = 0, j = 1; i < n; i += sz * 2, j++){ 
                for (int l = i, r = i + sz; l < i + sz; l++, r++) {
                    int x = a[l], y = a[r];
                    a[l] = x + y;
                    if (a[l] >= MOD) a[l] -= MOD;
                    a[r] = x - y;
                    if (a[r] < 0) a[r] += MOD;
                    a[r] = a[r] * e % MOD;
                }
                e = e * iw[__builtin_ctz(j)] % MOD;
            }
        }
        long long in = inv(n);
        for (int i = 0; i < n; i++) a[i] = a[i] * in % MOD;
    }
}

template <int MOD> vector<int> ntt<MOD>::convolute(const vector<int>& a, const vector<int>& b) const {
    int n = (1 << (32 - __builtin_clz(a.size() + b.size() - 1)));
    vector<int> a2 = a, b2 = b;
    a2.resize(n);
    b2.resize(n);
    transform(a2);
    transform(b2);
    for (int i = 0; i < n; i++) a2[i] = (long long)a2[i] * b2[i] % MOD;
    transform(a2, true);
    a2.resize(a.size() + b.size() - 1);
    return a2;
}

class ntt_int {
    public:
    vector<long long> convolute(const vector<int>& a, const vector<int>& b) const;
    
    private:
    constexpr static int MOD1 = 1045430273;
    constexpr static int MOD2 = 1051721729;
    constexpr static long long MOD = (long long)MOD1 * MOD2;
    constexpr static ntt<MOD1> NTT1 = ntt<MOD1>();
    constexpr static ntt<MOD2> NTT2 = ntt<MOD2>();
    constexpr static int R = NTT2.inv(MOD1);
};

vector<long long> ntt_int::convolute(const vector<int>& a, const vector<int>& b) const {
    vector<int> v1 = NTT1.convolute(a, b);
    vector<int> v2 = NTT2.convolute(a, b);
    int n = v1.size();
    vector<long long> v(n);
    for (int i = 0; i < n; i++) v[i] = (v1[i] + (long long)(v2[i] - v1[i] + MOD2) * R % MOD2 * MOD1) % MOD;
    return v;
}

const int mod = 200003;
int a[200000];
int b[mod];
int c[mod];
long long sum[mod];

int main() {
    int n, g = 2, x = 1, i;
    long long ans = 0;
    vector<int> v(mod);
    vector<long long> w;
    ntt_int ntt;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    
    for (i = 0; i < mod - 1; i++) {
        b[i] = x;
        x = (long long)x * g % mod;
    }
    
    for (i = 0; i < mod - 1; i++) c[b[i]] = i;
    
    for (i = 0; i < n; i++) {
        if (a[i] > 0) v[c[a[i]]]++;
    }
    
    w = ntt.convolute(v, v);
    
    for (i = 0; i < w.size(); i++) sum[b[i % (mod - 1)]] += w[i];
    
    for (i = 0; i < n; i++) sum[(long long)a[i] * a[i] % mod]--;
    
    for (i = 1; i < mod; i++) ans += sum[i] / 2 * i;
    
    printf("%lld\n", ans);
    
    return 0;
}


Measured memory_bytes: 16776