#include<bits/stdc++.h>

using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;
//const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

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

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

static constexpr uint32_t mul_inv(uint32_t n, int e = 5, uint32_t x = 1) {
  return e == 0 ? x : mul_inv(n, e - 1, x * (2 - x * n));
}

template< uint32_t mod, bool fast = false >
struct ModInt {
  using u32 = uint32_t;
  using u64 = uint64_t;

  static constexpr u32 inv = mul_inv(mod);
  static constexpr u32 r2 = -uint64_t(mod) % mod;

  uint32_t x;

  ModInt() : x(0) {}

  ModInt(const int64_t &y)
      : x(reduce(u64(fast ? y : (y >= 0 ? y % mod : (mod - (-y) % mod) % mod)) * r2)) {}

  u32 reduce(const u64 &w) const {
    return u32(w >> 32) + mod - u32((u64(u32(w) * inv) * mod) >> 32);
  }

  ModInt &operator+=(const ModInt &p) {
    if(int(x += p.x - 2 * mod) < 0) x += 2 * mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if(int(x -= p.x) < 0) x += 2 * mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = reduce(uint64_t(x) * p.x);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt() - *this; }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return get() == p.get(); }

  bool operator!=(const ModInt &p) const { return get() != p.get(); }

  int get() const { return reduce(x) % mod; }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(*this);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  ModInt inverse() const {
    return pow(mod - 2);
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.get();
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod, fast >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< mod, true >;

template< typename Mint >
struct NumberTheoreticTransformFriendlyModInt {

  vector< Mint > dw, idw;
  int max_base;
  Mint root;

  NumberTheoreticTransformFriendlyModInt() {
    const unsigned mod = Mint::get_mod();
    assert(mod >= 3 && mod % 2 == 1);
    auto tmp = mod - 1;
    max_base = 0;
    while(tmp % 2 == 0) tmp >>= 1, max_base++;
    root = 2;
    while(root.pow((mod - 1) >> 1) == 1) root += 1;
    assert(root.pow(mod - 1) == 1);
    dw.resize(max_base);
    idw.resize(max_base);
    for(int i = 0; i < max_base; i++) {
      dw[i] = -root.pow((mod - 1) >> (i + 2));
      idw[i] = Mint(1) / dw[i];
    }
  }

  void ntt(vector< Mint > &a) {
    const int n = (int) a.size();
    assert((n & (n - 1)) == 0);
    assert(__builtin_ctz(n) <= max_base);
    for(int m = n; m >>= 1;) {
      Mint w = 1;
      for(int s = 0, k = 0; s < n; s += 2 * m) {
        for(int i = s, j = s + m; i < s + m; ++i, ++j) {
          auto x = a[i], y = a[j] * w;
          a[i] = x + y, a[j] = x - y;
        }
        w *= dw[__builtin_ctz(++k)];
      }
    }
  }

  void intt(vector< Mint > &a, bool f = true) {
    const int n = (int) a.size();
    assert((n & (n - 1)) == 0);
    assert(__builtin_ctz(n) <= max_base);
    for(int m = 1; m < n; m *= 2) {
      Mint w = 1;
      for(int s = 0, k = 0; s < n; s += 2 * m) {
        for(int i = s, j = s + m; i < s + m; ++i, ++j) {
          auto x = a[i], y = a[j];
          a[i] = x + y, a[j] = (x - y) * w;
        }
        w *= idw[__builtin_ctz(++k)];
      }
    }
    if(f) {
      Mint inv_sz = Mint(1) / n;
      for(int i = 0; i < n; i++) a[i] *= inv_sz;
    }
  }

  vector< Mint > multiply(vector< Mint > a, vector< Mint > b) {
    int need = a.size() + b.size() - 1;
    int nbase = 1;
    while((1 << nbase) < need) nbase++;
    int sz = 1 << nbase;
    a.resize(sz, 0);
    b.resize(sz, 0);
    ntt(a);
    ntt(b);
    Mint inv_sz = Mint(1) / sz;
    for(int i = 0; i < sz; i++) a[i] *= b[i] * inv_sz;
    intt(a, false);
    a.resize(need);
    return a;
  }
};


template< int mod >
vector< int > AnyModNTTMultiply(vector< int > &a, vector< int > &b) {
  using mint = ModInt< mod >;
  using mint1 = ModInt< 1045430273 >;
  using mint2 = ModInt< 1051721729 >;
  using mint3 = ModInt< 1053818881 >;
  NumberTheoreticTransformFriendlyModInt< mint1 > ntt1;
  NumberTheoreticTransformFriendlyModInt< mint2 > ntt2;
  NumberTheoreticTransformFriendlyModInt< mint3 > ntt3;
  vector< mint1 > a1(begin(a), end(a)), b1(begin(b), end(b));
  vector< mint2 > a2(begin(a), end(a)), b2(begin(b), end(b));
  vector< mint3 > a3(begin(a), end(a)), b3(begin(b), end(b));
  auto x = ntt1.multiply(a1, b1);
  auto y = ntt2.multiply(a2, b2);
  auto z = ntt3.multiply(a3, b3);
  const int m1 = 1045430273, m2 = 1051721729, m3 = 1053818881;
  const auto m1_inv_m2 = mint2(m1).inverse().get();
  const auto m12_inv_m3 = (mint3(m1) * m2).inverse().get();
  const auto m12_mod = (mint(m1) * m2).get();
  vector< int > ret(x.size());
  for(int i = 0; i < x.size(); i++) {
    auto v1 = ((mint2(y[i]) + m2 - x[i].get()) * m1_inv_m2).get();
    auto v2 = ((z[i] + m3 - x[i].get() - mint3(m1) * v1) * m12_inv_m3).get();
    ret[i] = (mint(x[i].get()) + mint(m1) * v1 + mint(m12_mod) * v2).get();
  }
  return ret;
}



// >>> fast IO by yosupo
template< class T > using V = vector< T >;

struct Scanner {
  FILE *fp = nullptr;
  char line[1 << 15];
  size_t st = 0, ed = 0;

  void reread() {
    memmove(line, line + st, ed - st);
    ed -= st;
    st = 0;
    ed += fread(line + ed, 1, (1 << 15) - ed, fp);
  }

  bool succ() {
    while(true) {
      if(st == ed) {
        reread();
        if(st == ed) return false;
      }
      while(st != ed && isspace(line[st])) st++;
      if(st != ed) break;
    }
    if(ed - st <= 50) reread();
    return true;
  }

  template< class T, enable_if_t< is_same< T, string >::value, int > = 0 >
  bool read_single(T &ref) {
    if(!succ()) return false;
    while(true) {
      succ();
      size_t sz = 1;
      while(st + sz < ed && !isspace(line[st + sz])) sz++;
      ref.append(line + st, sz);
      st += sz;
      if(st != ed) break;
    }
    return true;
  }

  template< class T, enable_if_t< is_integral< T >::value, int > = 0 >
  bool read_single(T &ref) {
    if(!succ()) return false;
    bool neg = false;
    if(line[st] == '-') {
      neg = true;
      st++;
    }
    ref = T(0);
    while(isdigit(line[st])) {
      ref = 10 * ref + (line[st++] - '0');
    }
    if(neg) ref = -ref;
    return true;
  }

  template< class T >
  bool read_single(V< T > &ref) {
    for(auto &d : ref) {
      if(!read_single(d)) return false;
    }
    return true;
  }

  void read() {}

  template< class H, class... T >
  void read(H &h, T &... t) {
    bool f = read_single(h);
    assert(f);
    read(t...);
  }

  Scanner(FILE *_fp) : fp(_fp) {}
};

struct Printer {
public:
  template< bool F = false >
  void write() {}

  template< bool F = false, class H, class... T >
  void write(const H &h, const T &... t) {
    if(F) write_single(' ');
    write_single(h);
    write< true >(t...);
  }

  template< class... T >
  void writeln(const T &... t) {
    write(t...);
    write_single('\n');
  }

  Printer(FILE *_fp) : fp(_fp) {}

  ~Printer() { flush(); }

private:
  static constexpr size_t SIZE = 1 << 15;
  FILE *fp;
  char line[SIZE], small[50];
  size_t pos = 0;

  void flush() {
    fwrite(line, 1, pos, fp);
    pos = 0;
  }

  void write_single(const char &val) {
    if(pos == SIZE) flush();
    line[pos++] = val;
  }

  template< class T, enable_if_t< is_same< T, string >::value, int > = 0 >
  void write_single(const T &val) {
    for(char c : val) write_single(c);
  }

  template< class T, enable_if_t< is_integral< T >::value, int > = 0 >
  void write_single(T val) {
    if(pos > (1 << 15) - 50) flush();
    if(val == 0) {
      write_single('0');
      return;
    }
    if(val < 0) {
      write_single('-');
      val = -val;  // todo min
    }
    size_t len = 0;
    while(val) {
      small[len++] = char('0' + (val % 10));
      val /= 10;
    }
    reverse(small, small + len);
    memcpy(line + pos, small, len);
    pos += len;
  }

  template< class T >
  void write_single(const V< T > &val) {
    auto n = val.size();
    for(size_t i = 0; i < n; i++) {
      if(i) write_single(' ');
      write_single(val[i]);
    }
  }
};
// <<<

namespace fft{
    const long double PI = acos(-1);
    vector<complex<long double>> e;

    template <typename T>
    vector<complex<long double>> _fft(const vector<T> &A, int x, const int m){
        int n = A.size() / abs(m);
        vector<complex<long double>> res(n);
        if (n == 1){
            res[0] = A[x];
            return res;
        }

        auto E = _fft(A, x, m * 2), O = _fft(A, x + abs(m), m * 2);        
        
        for (int i = 0; i < n / 2; i++){
            res[i] = E[i] + e[(i * m) % e.size()] * O[i];
            res[i + n / 2] = E[i] - e[(i * m) % e.size()] * O[i];
        }
        return res;
    }

    template <typename T>
    void _init(vector<T> &A){
        int n = 1 << (int)ceil(log2(A.size()));
        A.resize(n);
        e.resize(n);
        auto base = exp(complex<long double>(0, 2 * PI / n));
        complex<long double> cur(1, 0);
        for (int i = 0; i < n; i++){
            e[i] = cur;
            cur *= base;
        }
    }

    template <typename T>
    vector<complex<long double>> fft(vector<T> &A){
        _init(A);
        return _fft(A, 0, -1);
    }

    template <typename T>
    vector<complex<long double>> ifft(vector<T> &A){
        _init(A);
        auto res = _fft(A, 0, 1);
        for (auto &r: res)
            r /= complex<long double>(A.size());
        return res;
    }

    template <typename T>
    vector<complex<long double>> convolution(vector<T> A, vector<T> B){
        A.resize(A.size() + B.size() - 1);
        B.resize(A.size());
        auto C = fft(A);
        auto D = fft(B);
        vector<complex<long double>> E(C.size());
        for (int i = 0; i < E.size(); i++)
            E[i] = C[i] * D[i];

        return ifft(E);
    }
}


int main(){
    const constexpr int64_t p = 200003;
    const ModInt<p> g = 2;
    int n;
    cin >> n;
    vector<int64_t> A(n);
    copy_n(istream_iterator<int64_t>(cin), n, A.begin());
    vector<int64_t> a_to_g(p), g_to_a(p);
    ModInt<p> k = 1;
    for (int i = 0; i < p - 1; i++){
        a_to_g[k.get()] = i;
        g_to_a[i] = k.get();
        k *= g;
    }
    
    vector<int64_t> G(p);
    for (int i = 0; i < n; i++){
        if (A[i] == 0)
            continue;
        G[a_to_g[A[i]]]++;
    }

    auto res = fft::convolution(G, G);
    int64_t ans = 0;
    for (int i = 0; i < p - 1; i++)
        ans += (int64_t(abs(res[i]) + 0.5) + int64_t(abs(res[i + p - 1]) + 0.5)) * g_to_a[i];
    for (int i = 0; i < n; i++)
        ans -= (A[i] * A[i]) % p;

    cout << ans / 2 << endl;
}

Measured memory_bytes: 132768