#pragma comment(linker, "/STACK:512000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
#ifdef AIM
#include <sys/resource.h>
#endif
using namespace std;

#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve(__attribute__((unused)) bool);
void precalc();
clock_t start;
#define FILENAME ""

int main() {
#ifdef AIM
  string s = FILENAME;
//    assert(!s.empty());
  freopen("/home/alexandero/ClionProjects/cryptozoology/input.txt", "r", stdin);
  //freopen("/home/alexandero/ClionProjects/cryptozoology/output.txt", "w", stdout);
#else
//    freopen(FILENAME ".in", "r", stdin);
//    freopen(FILENAME ".out", "w", stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    start = clock();
    int t = 1;
#ifndef AIM
  cout.sync_with_stdio(0);
  cin.tie(0);
#endif

#ifdef AIM
  const rlim_t kStackSize = 256 * 1024 * 1024;
  struct rlimit rl;
  int result;

  result = getrlimit(RLIMIT_STACK, &rl);
  if (result == 0)
  {
    if (rl.rlim_cur < kStackSize)
    {
      rl.rlim_cur = kStackSize;
      result = setrlimit(RLIMIT_STACK, &rl);
      if (result != 0)
      {
        fprintf(stderr, "setrlimit returned result = %d\n", result);
      }
    }
  }
#endif

  precalc();
  cout.precision(10);
  cout << fixed;
  //cin >> t;
  int testNum = 1;
  while (t--) {
      //cout << "Case #" << testNum++ << ": ";
      solve(true);
  }
  cout.flush();
#ifdef AIM1
    while (true) {
      solve(false);
  }
#endif

#ifdef AIM
  cout.flush();
  auto end = clock();

  usleep(10000);
  print_stats(end - start);
  usleep(10000);
#endif

    return 0;
}

template<typename T>
T binpow(T q, T w, T mod) {
    if (!w)
        return 1 % mod;
    if (w & 1)
        return q * 1LL * binpow(q, w - 1, mod) % mod;
    return binpow(q * 1LL * q % mod, w / 2, mod);
}

template<typename T>
T gcd(T q, T w) {
    while (w) {
        q %= w;
        swap(q, w);
    }
    return q;
}
template<typename T>
T lcm(T q, T w) {
    return q / gcd(q, w) * w;
}

template <typename T>
void make_unique(vector<T>& a) {
    sort(all(a));
    a.erase(unique(all(a)), a.end());
}

template<typename T>
void relax_min(T& cur, T val) {
    cur = min(cur, val);
}

template<typename T>
void relax_max(T& cur, T val) {
    cur = max(cur, val);
}

void precalc() {
}

#define int li
const int mod = 200003;

const int L = 20;
const int N = 1 << L;
bool fft_initialized = false;

using ld = long double;
using base = complex<ld>;
using Poly = vector<li>;

const ld pi = acosl(-1);
base angles[N + 1];
int bitrev[N];

// don't know why such eps, may be changed
const ld eps = 1e-7;

inline bool eq(ld x, ld y) {
  return abs(x - y) < eps;
}

void fft_init() {
  for (int i = 0; i <= N; ++i) {
    angles[i] = {cosl(2 * pi * i / N), sinl(2 * pi * i / N)};
  }

  for (int i = 0; i < N; ++i) {
    int x = i;
    for (int j = 0; j < L; ++j) {
      bitrev[i] = (bitrev[i] << 1) | (x & 1);
      x >>= 1;
    }
  }

  fft_initialized = true;
}

inline int revBit(int x, int len) {
  return bitrev[x] >> (L - len);
}

void fft(vector<base>& a, bool inverse = false) {
  assert(fft_initialized && "you fucking cunt just write fft_init()");
  int n = a.size();
  assert(!(n & (n - 1)));	// work only with powers of two
  int l = __builtin_ctz(n);

  for (int i = 0; i < n; ++i) {
    int j = revBit(i, l);
    if (i < j) {
      swap(a[i], a[j]);
    }
  }

  for (int len = 1; len < n; len *= 2) {
    for (int start = 0; start < n; start += 2 * len) {
      for (int i = 0; i < len; ++i) {
        base x = a[start + i], y = a[start + len + i];
        int idx = N / 2 / len * i;
        base w = y * angles[inverse ? N - idx : idx];
        a[start + i] = x + w;
        a[start + len + i] = x - w;
      }
    }
  }

  if (inverse) {
    for (auto& x : a) {
      x /= n;
    }
  }
}

Poly multiply(Poly a, Poly b) {
  int n = 1;
  while (n < (int)a.size() || n < (int)b.size()) {
    n *= 2;
  }
  vector<base> ar(n + n), br(n + n);
  for (int i = 0; i < (int)a.size(); ++i) {
    ar[i] = a[i];
  }
  for (int i = 0; i < (int)b.size(); ++i) {
    br[i] = b[i];
  }
  fft(ar);
  fft(br);
  for (int i = 0; i < n + n; ++i) {
    ar[i] = ar[i] * br[i];
  }
  fft(ar, true);
  while (!ar.empty() && eq(norm(ar.back()), 0)) {
    ar.pop_back();
  }
  a.resize(ar.size());
  for (int i = 0; i < (int)a.size(); ++i) {
    a[i] = (li)round(real(ar[i]));
  }
  return a;
}

void solve(__attribute__((unused)) bool read) {
  fft_init();

  vector<int> divs = {2, 11, 9091};
  int g = 2;
  for (; ; ++g) {
    bool f = true;
    for (int d : divs) {
      if (binpow(g, (mod - 1) / d, mod) == 1) {
        f = false;
        break;
      }
    }
    if (f) {
      break;
    }
  }
  //cout << "g: " << g << endl;
  vector<int> key(mod - 1);
  vector<int> val(mod - 1);
  int step = 1;
  for (int i = 0; i + 1 < mod; ++i) {
    val[i] = step;
    key[step] = i;
    step = step * g % mod;
  }
  vector<int> cnt(mod - 1, 0);
  {
    int n;
    //read = false;
    if (read) {
      cin >> n;
    } else {
      n = 200000;
    }
    for (int i = 0; i < n; ++i) {
      int cur;
      if (read) {
        cin >> cur;
      } else {
        cur = 1 + rand() % (mod - 1);
      }
      if (cur) {
        ++cnt[key[cur]];
      }
    }
  }
  auto multed = multiply(cnt, cnt);
  li res = 0;
  for (int i = 0; i < multed.size(); ++i) {
    res += val[i % (mod - 1)] * multed[i];
  }
  for (int i = 0; i < cnt.size(); ++i) {
    res -= (val[i] * val[i] % mod) * cnt[i];
  }
  assert(res % 2 == 0);
  res /= 2;
  cout << res << endl;
}

Measured memory_bytes: 88376