#include <bits/stdc++.h>
using namespace std;

#define double long double
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) static_cast<int>((x).size())

template<class T, size_t D>
struct vec : vector<vec<T, D - 1>> {
  template<class... Args>
  vec(size_t n = 0, Args... args)
      : vector<vec<T, D - 1>>(n, vec<T, D - 1>(args...)) {}
};
template<class T>
struct vec<T, 1> : vector<T> {
  template<class... Args>
  vec(Args... args)
      : vector<T>(args...) {}
};

template<class T>
inline bool Minimize(T& a, const T& b) { return a > b ? a = b, true : false; }
template<class T>
inline bool Maximize(T& a, const T& b) { return a < b ? a = b, true : false; }
inline int Next(int i, int n) { return i == n - 1 ? 0 : i + 1; }
inline int Prev(int i, int n) { return !i ? n - 1 : i - 1; }

mt19937 rng(static_cast<uint32_t>(chrono::steady_clock::now().time_since_epoch().count()));

constexpr int kMod = 200003;
const double kPi = acos(-1);

template<int Mod>
struct ModInt {
  int a;
  ModInt(int t_a = 0) {
    a = (t_a < Mod ? (t_a < 0 ? t_a + Mod : t_a) : t_a - Mod);
  }
  friend istream& operator>>(istream& in_stream, ModInt& o) {
    in_stream >> o.a;
    o.a = (o.a < Mod ? (o.a < 0 ? o.a + Mod : o.a) : o.a - Mod);
    return in_stream;
  }
  friend ostream& operator<<(ostream& out_stream, const ModInt& o) {
    out_stream << o.a;
    return out_stream;
  }

  bool operator<(const ModInt& o) const { return a < o.a; }
  bool operator==(const ModInt& o) const { return a == o.a; }

  bool operator!() const { return !a; }
  explicit operator bool() const { return !!a; }

  ModInt operator-() const { return ModInt() - *this; }
  ModInt operator+(const ModInt& o) const { return ModInt(a + o.a); }
  ModInt operator-(const ModInt& o) const { return ModInt(a - o.a); }
  ModInt operator*(const ModInt& o) const { return ModInt(static_cast<int>(static_cast<int64_t>(a) * o.a % Mod)); }
  ModInt operator/(const ModInt& o) const { return *this * o.Inverse(); }
  ModInt& operator+=(const ModInt& o) { return *this = *this + o; }
  ModInt& operator-=(const ModInt& o) { return *this = *this - o; }
  ModInt& operator*=(const ModInt& o) { return *this = *this * o; }
  ModInt& operator/=(const ModInt& o) { return *this = *this / o; }
  ModInt& operator++() { return *this = *this + ModInt(1); }
  ModInt& operator--() { return *this = *this - ModInt(1); }
  ModInt Inverse() const { return Power(Mod - 2); }
  template<class T>
  ModInt Power(T exp) const {
    ModInt ret(1), c = *this;
    for (; exp; exp >>= 1, c *= c) {
      if (exp & 1) {
        ret *= c;
      }
    }
    return ret;
  }
};
using Mint = ModInt<kMod>;
Mint g(2);

struct Polynomial : vec<complex<double>, 1> {
  template<class... Args>
  Polynomial(Args... args)
      : vec<complex<double>, 1>(args...) {}

  void FFT(bool inverse = false) {
    int n = SZ(*this);
    for (int i = 0, k = __lg(n); i < n; ++i) {
      int reverse_i = 0;
      for (int j = 0; j < k; ++j) {
        reverse_i |= (i >> j & 1) << (k - 1 - j);
      }
      if (i < reverse_i) {
        std::swap((*this)[i], (*this)[reverse_i]);
      }
    }

    for (int length = 2; length <= n; length <<= 1) {
      double angle = kPi * 2 / length * (inverse ? -1 : 1);
      complex<double> w_length(cos(angle), sin(angle));
      for (int i = 0; i < n; i += length) {
        complex<double> w(1);
        for (int j = 0; j < length >> 1; ++j) {
          complex<double> a = (*this)[i + j], b = w * (*this)[i + (length >> 1) + j];
          (*this)[i + j] = a + b;
          (*this)[i + (length >> 1) + j] = a - b;
          w *= w_length;
        }
      }
    }
    if (inverse) {
      for (auto& i : *this) {
        i /= n;
      }
    }
  }
  Polynomial& operator*=(Polynomial o) {
    int n = SZ(*this) + SZ(o) - 1;
    int length = 1;
    while (length < n) {
      length <<= 1;
    }

    resize(length); FFT();
    o.resize(length); o.FFT();
    for (int i = 0; i < length; ++i) {
      (*this)[i] *= o[i];
    }
    FFT(true); resize(n);
    return *this;
  }
  Polynomial operator*(const Polynomial& o) const { return Polynomial(ALL(*this)) *= o; }
};

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);

  vec<Mint, 1> powers_g(kMod - 1);
  vec<int, 1> ranks(kMod);
  powers_g[0] = Mint(1); ranks[1] = 0;
  for (int i = 1; i < kMod - 1; ++i) {
    powers_g[i] = powers_g[i - 1] * g;
    ranks[powers_g[i].a] = i;
  }

  int n; cin >> n;
  vec<int, 1> amounts(kMod - 1);
  while (n--) {
    int a; cin >> a;
    if (a) {
      ++amounts[ranks[a]];
    }
  }

  vec<int64_t, 1> amounts_2(kMod - 1);

  Polynomial a(kMod - 1);
  for (int i = 0; i < kMod - 1; ++i) {
    a[i] = complex<double>(amounts[i]);
  }
  a *= a;

  for (int i = 0; i < kMod - 1; ++i) {
    amounts_2[(i + i) % (kMod - 1)] += static_cast<int64_t>(amounts[i]) * (amounts[i] - 1) / 2;
    a[i + i] -= complex<double>(amounts[i]) * complex<double>(amounts[i]);
  }

  for (int i = 0; i <= (kMod - 2) << 1; ++i) {
    amounts_2[i % (kMod - 1)] += static_cast<int64_t>(a[i].real() + 0.5) / 2;
  }

  int64_t answer = 0;
  for (int i = 0; i < kMod - 1; ++i) {
    answer += amounts_2[i] * powers_g[i].a;
  }
  cout << answer << '\n';

  return 0;
}

Measured memory_bytes: 46720