#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define SZ(x) ((int)((x).size()))

template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
    bool done_something = false;
    stringstream res;
    res << "[";
    for (; begin_iter != end_iter and counter; ++begin_iter) {
        done_something = true;
        counter--;
        res << *begin_iter << ", ";
    }
    string str = res.str();
    if (done_something) {
        str.pop_back();
        str.pop_back();
    }
    str += "]";
    return str;
}

vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
    vector<int> ord(size);
    for (int i = 0; i < size; i++) ord[i] = i;
    sort(ord.begin(), ord.end(), compare);
    return ord;
}

template <typename T>
bool MinPlace(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool MaxPlace(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename S, typename T>
ostream& operator <<(ostream& out, const pair<S, T>& p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& v) {
    out << "[";
    for (int i = 0; i < (int)v.size(); i++) {
        out << v[i];
        if (i != (int)v.size()-1) out << ", ";
    }
    out << "]";
    return out;
}

template<class TH>
void _dbg(const char* name, TH val){
    clog << name << ": " << val << endl;
}
template<class TH, class... TA>
void _dbg(const char* names, TH curr_val, TA... vals) {
    while(*names != ',') clog << *names++;
    clog << ": " << curr_val << ", ";
    _dbg(names+1, vals...);
}

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file

    #define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
    #define dbg_arr(x, len) clog << #x << ": " << print_iterable(x, x+len, -1) << endl;
#else
    #define dbg(...)
    #define dbg_arr(x, len)
#endif

// Fast exponentiation modulo mod. Returns x**e modulo mod.
// Assumptions: 0 <= x < mod
//              mod < 2**31.
//              0 <= e < 2**63
LL pow(LL x, LL e, LL mod) {
    LL res = 1;
    for (; e >= 1; e >>= 1) {
        if (e & 1) res = res * x % mod;
        x = x * x % mod;
    }
    return res;
}


// Returns x such that Ord_mod(x) = order.
// Assumptions:
//  1. mod is an odd prime < 2**31
//  2. order | mod-1
//
// Complexity: sqrt(lpf(order)) + polylog(order).
// When this function is used as a building block for the number theoretic
// transform, order is a power of two and therefore the complexity is
// polylog(order).
LL FindElementWithGivenOrder(LL mod, LL order) {
    assert((mod-1)%order == 0);
    vector<LL> primes; // primes dividing order
    LL n = order;
    for (LL p = 2; p*p <= n; p++) {
        if (n % p == 0) {
            primes.push_back(p);
            while (n % p == 0) n /= p;
        }
    }
    if (n != 1) primes.push_back(n);
    for (LL x = 2; x < mod; x++) {
        LL y = pow(x, (mod-1)/order, mod);
        if (pow(y, order, mod) != 1) continue;
        bool works = true;
        for (LL p : primes) {
            if (pow(y, order/p, mod) == 1) {
                works = false;
                break;
            }
        }
        if (works) return y;
    }
    assert(0);
    return -1;
}



// Precomputes the vectors rev and roots as required by the function FFT.
// Should be executed only once, before all the calls to FFT, and N should be >=
// than the length of any vector for which the FFT will be computed.
//
// Both the arrays rev and roots have length N. Their values satisfy:
// - rev[i] is the bit-reverse of i.
// - roots contains the roots of unity. For any k that is a power of two,
//   and any i < k, roots[k + i] contains the i-th power of the (2k)-root of
//   unity. Using such an array speeds up (and simplifies) the code.
//
// Complexity: O(N)
//
// Assumptions:
//  1. The type T is either complex<double> or ModularInteger.
//  2. N power of 2
//  3. If T = ModularInteger, then ModularInteger::mod is prime and
//     N | mod-1 .
template <typename T>
void Precompute(int N, vector<int>& rev, vector<T>& roots) {
    // static_assert(std::is_same<T, ModularInteger>::value
                  // or std::is_same<T, complex<double>>::value);
    assert(N > 0 and !(N&(N-1)));
    rev.resize(N);
    roots.resize(N);
    rev[0] = 0;
    for (int i = 1; i < N; i++) rev[i] = (rev[i>>1]>>1) ^ ((i&1)?(N>>1):0);
    
    if (1) {
        for (int k = 1; k < N; k<<=1) {
            for (int i = 0; i < k; i++) {
                double theta = M_PI*i/k;
                roots[k+i] = cos(theta) + 1i * sin(theta);
            }
        }
    }
}

// Given a sequence of numbers computes the associated discrete Fourier
// transform in-place.
// If inverse=true then the inverse of the Fourier transform is computed.
// The parameters rev and roots are computed by the helper function Precompute.
//
// Complexity: O(Nlog(N)) where N = a.size().
//
// Assumptions:
//  1. The type T is either complex<double> or ModularInteger.
//  2. The length of a is a power of 2.
//  3. rev and roots have been computed by Precompute (with N >= size of a).
//  4. If T = ModularInteger, then ModularInteger::mod is prime and the
//     length of a divides mod-1 .
template <typename T>
void FFT(vector<T>& a, const vector<int>& rev, const vector<T>& roots,
         bool inverse=false) {        
    int N = a.size();
    assert(N > 0 and !(N&(N-1)));
    int offset = 0;
    while ((1<<offset) < (int)rev.size()/N) offset++;

    for (int i = 0; i < N; i++) if (i < (rev[i]>>offset)) {
        swap(a[i], a[rev[i]>>offset]);
    }
    
    for (int k = 1; k < N; k<<=1) {
        for (int i = 0; i < N; i+=2*k) {
            for (int j = 0; j < k; j++) {
                T x = a[i+j], y = a[i+k+j] * roots[k+j];
                a[i+j] = x + y;
                a[i+k+j] = x - y;
            }
        }
    }

    if (inverse) {
        reverse(a.begin()+1, a.end());
        for (auto& val : a) val /= static_cast<T>(N);
    }
}

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////

const LL P = 200003;
const LL G = 2;
LL pot[P];
LL logg[P];

vector<LL> sqpol(vector<LL> vec) {
    int L = vec.size();
    vector<LL> res(2*L-1, 0);
    for (int i = 0; i < L; i++) for (int j = 0; j < L; j++) res[i+j] += vec[i]*vec[j];
    return res;
}


vector<LL> sqpol_fast(vector<LL> vec) {
    vector<complex<double>> pol(1<<19, 0);
    for (int i = 0; i < SZ(vec); i++) pol[i] = vec[i];
    vector<int> rev;
    vector<complex<double>> roots;
    Precompute(1<<19, rev, roots);
    FFT(pol, rev, roots);
    for (complex<double>& x: pol) x = x*x;
    FFT(pol, rev, roots, true);
    vector<LL> res(1<<19);
    for (int i = 0; i < (1<<19); i++) res[i] = pol[i].real() + 0.5;
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Remove in problems with online queries!

    pot[0] = 1;
    for (int i = 1; i < P-1; i++) pot[i] = pot[i-1] * G % P;
    for (int i = 0; i < P-1; i++) logg[pot[i]] = i;

    int N;
    cin >> N;
    LL sq = 0;
    vector<LL> coef(P-1, 0);
    for (int i = 0; i < N; i++) {
        LL a;
        cin >> a;
        if (a == 0) continue;
        if (a != 0) coef[logg[a]]++;
        sq += a*a % P;
    }
    coef = sqpol_fast(coef);
    LL res = 0;
    for (int i = 0; i <= 2*(P-2); i++) res += coef[i]*pot[i % (P-1)];
    // dbg(res, sq);
    res -= sq;
    assert(res % 2 == 0);
    res /= 2;
    cout << res << "\n";
}


Measured memory_bytes: 32320