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

using Int = long long;
const char newl = '\n';

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
template<typename T=Int>
vector<T> read(size_t n){
  vector<T> ts(n);
  for(size_t i=0;i<n;i++) cin>>ts[i];
  return ts;
}


template<typename T>
T mod_pow(T a,long long n,T mod){
  using ll = long long;
  T res(1);
  while(n){
    if(n&1) res=(ll)res*a%mod;
    a=(ll)a*a%mod;
    n>>=1;
  }
  return res;
}


template<typename T>
map<T, Int> factorize(T x){
  map<T, Int> res;
  for(Int i=2;i*i<=x;i++){
    while(x%i==0){
      x/=i;
      res[i]++;
    }
  }
  if(x!=1) res[x]++;
  return res;
}

namespace FFT{
  using dbl = double;

  struct num{
    dbl x,y;
    num(){x=y=0;}
    num(dbl x,dbl y):x(x),y(y){}
  };

  inline num operator+(num a,num b){
    return num(a.x+b.x,a.y+b.y);
  }
  inline num operator-(num a,num b){
    return num(a.x-b.x,a.y-b.y);
  }
  inline num operator*(num a,num b){
    return num(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x);
  }
  inline num conj(num a){
    return num(a.x,-a.y);
  }

  Int base=1;
  vector<num> rts={{0,0},{1,0}};
  vector<Int> rev={0,1};

  const dbl PI=asinl(1)*2;

  void ensure_base(Int nbase){
    if(nbase<=base) return;

    rev.resize(1<<nbase);
    for(Int i=0;i<(1<<nbase);i++)
      rev[i]=(rev[i>>1]>>1)+((i&1)<<(nbase-1));

    rts.resize(1<<nbase);
    while(base<nbase){
      dbl angle=2*PI/(1<<(base+1));
      for(Int i=1<<(base-1);i<(1<<base);i++){
        rts[i<<1]=rts[i];
        dbl angle_i=angle*(2*i+1-(1<<base));
        rts[(i<<1)+1]=num(cos(angle_i),sin(angle_i));
      }
      base++;
    }
  }

  void fft(vector<num> &as){
    Int n=as.size();
    assert((n&(n-1))==0);

    Int zeros=__builtin_ctz(n);
    ensure_base(zeros);
    Int shift=base-zeros;
    for(Int i=0;i<n;i++)
      if(i<(rev[i]>>shift))
        swap(as[i],as[rev[i]>>shift]);

    for(Int k=1;k<n;k<<=1){
      for(Int i=0;i<n;i+=2*k){
        for(Int j=0;j<k;j++){
          num z=as[i+j+k]*rts[j+k];
          as[i+j+k]=as[i+j]-z;
          as[i+j]=as[i+j]+z;
        }
      }
    }
  }

  template<typename T>
  vector<long long> multiply(vector<T> &as,vector<T> &bs){
    Int need=as.size()+bs.size()-1;
    Int nbase=0;
    while((1<<nbase)<need) nbase++;
    ensure_base(nbase);

    Int sz=1<<nbase;
    vector<num> fa(sz);
    for(Int i=0;i<sz;i++){
      T x=(i<(Int)as.size()?as[i]:0);
      T y=(i<(Int)bs.size()?bs[i]:0);
      fa[i]=num(x,y);
    }
    fft(fa);

    num r(0,-0.25/sz);
    for(Int i=0;i<=(sz>>1);i++){
      Int j=(sz-i)&(sz-1);
      num z=(fa[j]*fa[j]-conj(fa[i]*fa[i]))*r;
      if(i!=j)
        fa[j]=(fa[i]*fa[i]-conj(fa[j]*fa[j]))*r;
      fa[i]=z;
    }
    fft(fa);

    vector<long long> res(need);
    for(Int i=0;i<need;i++)
      res[i]=round(fa[i].x);

    return res;
  }

};

//INSERT ABOVE HERE
template<typename T>
T order(T x,T MOD){
  static map<T, vector<T>> dp;
  vector<T> &ps=dp[MOD];
  if(ps.empty()){
    auto fs=factorize(MOD-1);
    for(auto p:fs) ps.emplace_back(p.first);
  }
  T res=MOD-1;
  for(T p:ps){
    while(res%p==0){
      if(mod_pow(x,res/p,MOD)!=1) break;
      res/=p;
    }
  }
  return res;
}

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  const Int MOD = 200003;
  if(false){
    for(Int i=1;i<MOD;i++){
      if(order(i,MOD)==MOD-1){
        cout<<i<<endl;
        return 0;
      }
    }
  }

  const Int R = 2;
  vector<Int> ord(MOD,-1);
  vector<Int> po(MOD);
  Int res=1;
  for(Int i=0;i+1<MOD;i++){
    assert(ord[res]<0);
    ord[res]=i;
    po[i]=res;
    res*=R;
    res%=MOD;
  }

  Int n;
  cin>>n;
  auto as=read(n);

  vector<Int> cnt(MOD,0);
  for(Int a:as){
    if(a==0) continue;
    // cout<<a<<":"<<ord[a]<<":"<<po[ord[a]]<<endl;
    cnt[ord[a]]++;
  }

  auto cs=FFT::multiply(cnt,cnt);
  Int ans=0;
  for(Int i=0;i<(Int)cs.size();i++) ans+=po[i%(MOD-1)]*cs[i];

  for(Int a:as) ans-=a*a%MOD;
  ans/=2;
  cout<<ans<<newl;
  return 0;
}


Measured memory_bytes: 33380