// #define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
#define SZ(x) (int)((x).size())
const int INF = 1 << 29;
const int MOD = 2e5 + 3;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

typedef complex<double> atom;

const int G = 2;

int64 power_mod(int64 a, int64 n) {
  int64 ret = 1;
  for (; n; n >>= 1) {
    if (n & 1) ret = ret * a % MOD;
    a = a * a % MOD;
  }
  return ret;
}

int64 inv_mod(int64 a) {
  return power_mod(a, MOD - 2);
}

void bit_reverse(vector<atom>& a) {
  int n = a.size();
  for (int i = 1, j = n / 2; i < n - 1; ++i) {
    if (i < j) swap(a[i], a[j]);
    int k = n / 2;
    for (; j >= k; k /= 2) j -= k;
    if (j < k) j += k;
  }
}

atom wn[1 << 19];

void fft(vector<atom>& a, int flag) {
  bit_reverse(a);
  int n = a.size();
  for (int k = 2; k <= n; k <<= 1) {
    for (int i = 0; i < n; i += k) {
      int wi = 0, step = n / k;
      for (int j = i; j < i + k / 2; ++j) {
        atom u = a[j];
        atom v = wn[wi] * a[j + k / 2];
        a[j] = u + v;
        a[j + k / 2] = u - v;
        wi += step;
      }
    }
  }
  if (flag < 0) {
    for (int i = 0; i < n; ++i) a[i] /= n;
  }
}

void fft_prepare(int n) {
  for (int i = 0; i < n; ++i) {
    wn[i] = atom{cos(2 * M_PI / n * i), sin(2 * M_PI / n * i)};
  }
}

namespace polynomial {
vector<int64> mul(const vector<int>& A, const vector<int>& B, int cap = INF) {
  int n = A.size(), m = B.size();
  int deg = n - 1 + m - 1;
  int len = 1;
  while (len <= deg) len <<= 1;

  fft_prepare(len);
  vector<atom> x(len), y(len);
  for (int i = 0; i < n; ++i) {
    x[i] = atom{double(A[i] & ((1 << 15) - 1)), double(A[i] >> 15)};
  }
  for (int i = 0; i < m; ++i) {
    y[i] = atom{double(B[i] & ((1 << 15) - 1)), double(B[i] >> 15)};
  }
  fft(x, 1);
  fft(y, 1);
  vector<atom> X0(len), X1(len), Y0(len), Y1(len);
  for (int i = 0; i < len; ++i) {
    int j = (len - i) & (len - 1);
    X0[i] = (x[i] + conj(x[j])) * atom{0.5, 0};
    X1[i] = (x[i] - conj(x[j])) * atom{0, -0.5};
    Y0[i] = (y[i] + conj(y[j])) * atom{0.5, 0};
    Y1[i] = (y[i] - conj(y[j])) * atom{0, -0.5};
  }
  for (int i = 0; i < len; ++i) {
    x[i] = X0[i] * Y0[i] + X0[i] * Y1[i] * atom{0, 1};
    y[i] = X1[i] * Y0[i] + X1[i] * Y1[i] * atom{0, 1};
  }

  for (int i = 0; i < len; ++i) wn[i] = conj(wn[i]);

  fft(x, -1);
  fft(y, -1);
  cap = min(cap, deg + 1);
  vector<int64> ret(cap);
  for (int i = 0; i < cap; ++i) {
    int64 sum = int64(x[i].real() + 0.5);// % MOD;
    sum += (int64(x[i].imag() + y[i].real() + 0.5) % MOD << 15);// % MOD;
    sum += (int64(y[i].imag() + 0.5) % MOD << 30);// % MOD;
    ret[i] = sum;// % MOD;
  }
  return ret;
}
}

using namespace polynomial;

int main() {
  vector<int> A(MOD), p(MOD - 1, 1);
  for (int i = 0; i < MOD - 1; ++i) {
    if (i > 0) p[i] = p[i - 1] * G % MOD;
    A[p[i]] = i;
  }
  int n;
  scanf("%d", &n);
  vector<int> f(MOD - 1);
  int64 ret = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    if (x == 0) continue;
    f[A[x]]++;
    trace(i, A[x]);
    ret -= 1LL * x * x % MOD;
  }
  auto F = mul(f, f);
  for (int k = 0; k <= 2 * MOD - 4; ++k) {
    ret += 1LL * F[k] * p[k % (MOD - 1)];
  }
  ret /= 2;
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 66184