#include<bits/stdc++.h>
 
using namespace std;
 
#define LL long long int
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int lgN = 20;
const int N = 6e5 + 5;
const int oo = 1e9 + 5;
const LL ooll = 1e18 + 5;
const int P = 200003;
const int MOD = 1e9 + 7;
const int M = 31622;
const int gen = 2;
const long double PI = acos(-1);
 
// clock_t start = clock();
#define CLD complex<long double>
#define LD long double

int bitrev[lgN][N];
CLD omega[lgN][N];
void pre_fft() {
  int i, j;
  for (j=0;j<(1<<1);j++) bitrev[1][j] = j;
  omega[1][0] = CLD(1, 0);
  omega[1][1] = CLD(-1, 0);
  for (i=2;i<lgN;i++) {
    LD angle = 2 * PI / ((LD)(1<<i));
    CLD w = CLD(cos(angle), -sin(angle));
    for (j=0;j<(1<<i);j++) {
      bitrev[i][j] = bitrev[i-1][j/2];
      if (j & 1) bitrev[i][j] += (1<<(i-1));
      if (j == 0) omega[i][j] = CLD(1, 0);
      else omega[i][j] = omega[i][j-1] * w;
    }
  }
}
void fft(vector<CLD> &res) {
  int n = res.size(), lgn = 0, i, j, k;
  for (;(1<<lgn)<n;lgn++);
  assert((1<<lgn)==n);
  for (i=0;i<n;i++) if (i < bitrev[lgn][i]) swap(res[i], res[bitrev[lgn][i]]);
  for (i=1;i<=lgn;i++) {
    int b = n/(1<<i), bsz = (1<<i);
    for (j=0;j<b;j++) {
      // LD angle = (2*PI/((LD)bsz));
      // CLD tw = CLD(cos(angle), -sin(angle));
      // CLD w = CLD(1, 0);
      for (k=0;k<bsz/2;k++) {
        CLD fir = res[j * bsz + k], sec = res[j * bsz + k + bsz/2] * omega[i][k];
        res[j * bsz + k] = fir + sec;
        res[j * bsz + k + bsz/2] = fir - sec;
        // w *= tw;
      }
    }
  }
}
vector<LL> mul(vector<LL> a, vector<LL> b) {
  int n = (int)a.size() + (int)b.size(), lgn = 0, i, j;
  for (;(1<<lgn)<=n;lgn++);
  n = (1<<lgn);
  a.resize(n);
  b.resize(n);
  vector<CLD> ffta(n), fftb(n), fftc(n), fftd(n);
  for (i=0;i<n;i++) ffta[i] = CLD((LD)(a[i]%M), (LD)(a[i]/M));
  fft(ffta);
  for (i=0;i<n;i++) fftb[i] = CLD((LD)(b[i]%M), (LD)(b[i]/M));
  fft(fftb);
  for (i=0;i<n;i++) {
    CLD A, B, C, D;
    A = (conj(ffta[i]) + ffta[(n-i)%n]) * CLD(0.5, 0);
    B = (conj(ffta[i]) - ffta[(n-i)%n]) * CLD(0, 0.5);
    C = (conj(fftb[i]) + fftb[(n-i)%n]) * CLD(0.5, 0);
    D = (conj(fftb[i]) - fftb[(n-i)%n]) * CLD(0, 0.5);
    fftc[i] = (A * C) + (CLD(0, -1) * (B * D));
    fftd[i] = (A * D) + (B * C);
    // fftc[i] = conj(fftc[i]);
    // fftd[i] = conj(fftd[i]);
  }
  fft(fftc);fft(fftd);

  vector<LL> ans(n);
  for (i=0;i<n;i++) {
    fftc[i] = conj(fftc[i]);
    fftd[i] = conj(fftd[i]);
    LL fir = (fftc[i].real() / ((LD)n) + 0.5);
    LL sec = (fftc[i].imag() / ((LD)n) + 0.5);
    ans[i] = (fir + ((sec * M)) * M);
    fir = (fftd[i].real() / ((LD)n) + 0.5);
    ans[i] = (ans[i] +(fir * M));
  }
  return ans;
}

LL powermod(LL a, LL b, LL mod) {
    LL res = 1, mul = a, pw = 1;
    while(pw <= b) {
        if (b & pw) res = (res * mul)%mod;
        mul = (mul * mul)%mod;
        pw <<= 1;
    }
    return res;
}

int discrete_log[P];

void pre() {
    int pw = 1;
    for (int i=0;i<P-1;++i) {
        discrete_log[pw] = i;
        pw <<= 1;
        if (pw >= P) pw -= P;
    }
}

void solve() {
    vector<LL> vec(P-1, 0), res;
    int n, zero = 0;
    cin >> n;
    for (int i=0;i<n;++i) {
        int x; cin >> x;
        if (x == 0) zero++;
        else {
            vec[discrete_log[x]]++;
        }
    }
    res = mul(vec, vec);
    int m = res.size();
    vector<LL> cnt(P, 0);
    int pw = 1;
    for (int i=0;i<m;++i) {
        cnt[pw] += res[i];
        pw <<= 1;
        if (pw >= P) pw -= P;
    }
    LL ans = 0;
    for (int i=1;i<P;++i) ans += i * cnt[i];
    pw = 1;
    for (int i=0;i<P-1;++i) {
        ans -= vec[i] * pw;
        pw <<= 2;
        while (pw >= P) pw -= P;
    }
    cout << ans / 2 << '\n';
}   

void tstmul() {
    int n;
    cin >> n;
    vector<LL> v(n);
    for (int i=0;i<n;++i) cin >> v[i];
    auto w = mul(v, v);
    for (auto it : w) cout << it << " ";
    cout << '\n';
}

int main() {
    FASTIO;
    pre_fft();
    pre();
    // tstmul();
    // return 0;
    int T = 1;
    // cin >> T;
    while(T--) {
        solve();
    }
    // cout << fixed << setprecision(10);
    // cout << (clock() - start) / ((long double)CLOCKS_PER_SEC) << '\n';
    return 0;
} 

Measured memory_bytes: 120520