/*
    写class的易坑点: (待持续更新)
	    1. new 的数组不够
		2. 能用具体空间大小的尽量不用 sizeof
		 
*/
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<map>
#include<queue>
#include<unordered_map>
#include<vector>
#include<stack> 
#define ll long long
#define ul unsigned long long
#define pb push_back
#define iter unordered_map<ll,int> :: iterator
#define lc (o<<1)
#define rc ((o<<1)|1)
#define MID (l+r>>1)

using namespace std;

namespace READ_AND_WRITE{
	inline int read(){
		char ch=getchar(); int x=0,f=1;
		for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-1;
		for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
		return x*f;
	}
	
	void W(int x){ if(x>=10) W(x/10); putchar('0'+x%10);}
	void W(ll x){ if(x>=10) W(x/10); putchar('0'+x%10);}
	
	inline ll READ(){
		char ch=getchar(); ll x=0,f=1;
		for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-1;
		for(;isdigit(ch);ch=getchar()) x=x*(ll)10+ch-'0';
		return x*f;
	}
	
	inline void get_num(int *a,int Begin,int End){
		for(int i=Begin;i<=End;i++) a[i]=read();
	}
	
	inline void put_num(int *a,int Begin,int End){
		for(int i=Begin;i<=End;i++) W(a[i]),putchar(' ');
		puts("");	
	}
	
	template<class T>
	inline void print(vector<T> &o){
		for(T i:o) W(i),putchar(' ');
		puts("");
	}
	
	inline int getid(char x){ return x-'a';}
}
using namespace READ_AND_WRITE;

namespace ALGORITHM{
	template<class T,class H>
	inline T Divide(T L,T R,H f){
		T ans,mid;
		for(;L<=R;){
			mid=(L+R)/2;
			if(f(mid)) ans=mid,L=mid+1;
			else R=mid-1;
		}
		return ans;
	}
	
	template<class T>
	inline bool bigger(T a,T b){
		return a>b;
	}
	template<class T>
	inline bool smaller(T a,T b){
		return a<b;
	}
	template<class T>
	inline bool not_smaller(T a,T b){
		return !smaller(a,b);
	}
	template<class T>
	inline bool not_bigger(T a,T b){
		return !bigger(a,b);
	}	
	
	
}
using namespace ALGORITHM;

namespace Number{
	const double eps=1e-6;
	const int ha1=998244353,ha2=1e9+7,ha3=1e9+9,ha4=200003;
	const int ha=ha4,inv2=ha/2+1,lss=60;
    int UUU,VVV,ddd;
    ll uuu,vvv,DDD;
    
	inline bool is_zero(double x){
	    return x>=-eps&&x<=eps;
    }
    
    int gcd(int x,int y){ return !y?x:gcd(y,x%y);}
    ll gcd(ll x,ll y){ return !y?x:gcd(y,x%y);}
    
    void gcd(int a,int b,int &d,int &x,int &y){
    	if(!b){ x=1,y=0,d=a; return;}
    	gcd(b,a%b,d,y,x),y-=x*(a/b);
	}
    
    void gcd(ll a,ll b,ll &d,ll &x,ll &y){
    	if(!b){ x=1,y=0,d=a; return;}
    	gcd(b,a%b,d,y,x),y-=x*(a/b);
	}
    
    int lcm(int x,int y){ return x/gcd(x,y)*y;}
    ll lcm(ll x,ll y){ return x/gcd(x,y)*y;}
    
    inline int add(int x,int y){ x+=y; return x>=ha?x-ha:x;}
    inline void ADD(int &x,int y){ x+=y; if(x>=ha) x-=ha;}
    inline int add(int x,int y,const int &HA){ x+=y; return x>=HA?x-HA:x;}
    inline void ADD(int &x,int y,const int &HA){ x+=y; if(x>=HA) x-=HA;}
    
    inline int add(int x,int y,const ll &HA){ x+=y; return x>=HA?x-HA:x;}
    inline void ADD(int &x,int y,const ll &HA){ x+=y; if(x>=HA) x-=HA;}
    
    inline ll add(ll x,ll y,const ll &HA){ x+=y; return x>=HA?x-HA:x;}
    inline void ADD(ll &x,ll y,const ll &HA){ x+=y; if(x>=HA) x-=HA;}

    inline int dec(int x,int y){ return add(x,ha-y);}
    inline void DEC(int &x,int y){ ADD(x,ha-y);}
    inline int dec(int x,int y,const int &HA){ return add(x,HA-y,HA);}
    inline void DEC(int &x,int y,const int &HA){ ADD(x,HA-y,HA);}
    
    inline int dec(int x,int y,const ll &HA){ return add(x,(int)HA-y,HA);}
    inline void DEC(int &x,int y,const ll &HA){ ADD(x,(int)HA-y,HA);}
    
    inline ll dec(ll x,ll y,const ll &HA){ return add(x,HA-y,HA);}
    inline void DEC(ll &x,ll y,const ll &HA){ ADD(x,HA-y,HA);}
    
    inline int mul(int x,int y){ return x*(ll)y%ha;}
    inline void MUL(int &x,int y){ x=mul(x,y);}
    inline int mul(int x,int y,const int &HA){ return x*(ll)y%HA;}
    inline void MUL(int &x,int y,const int &HA){ x=mul(x,y,HA);}

    inline int mul(int x,int y,const ll &HA){ return x*(ll)y%HA;}
    inline void MUL(int &x,int y,const ll &HA){ x=mul(x,y,HA);}
    
    inline ll mul(ll x,ll y,const ll &HA){
        ll an=0;
        for(;y;y>>=1,ADD(x,x,HA)) if(y&1) ADD(an,x,HA);
        return an;   	
	}
	inline void MUL(ll &x,ll y,const ll &HA){ x=mul(x,y,HA);}
    
    inline int div2(int x){ return x*(ll)inv2%ha;}
    
    inline int qz(int x){ return div2(mul(x,x+1));}

    inline int ksm(int x,int y){
        int an=1;
        for(;y;y>>=1,MUL(x,x)) if(y&1) MUL(an,x);
        return an;
    }
    inline int ksm(int x,int y,const int &HA){
        int an=1;
        for(;y;y>>=1,MUL(x,x,HA)) if(y&1) MUL(an,x,HA);
        return an;    	
	}
	inline ll ksm(ll x,ll y,const ll &HA){	
        ll an=1;
        for(;y;y>>=1,MUL(x,x,HA)) if(y&1) MUL(an,x,HA);
        return an;		
	}
	
	inline int get_inv(int x){ return ksm(x,ha-2);}
//	inline ll get_inv(ll x){ return ksm(x,ha-2);}	
	
	inline int get_inv(int x,int y){
		gcd(x,y,ddd,UUU,VVV);
		if(ddd>1) return -1;
		return UUU<0?UUU+y:UUU;
	}
	
	inline ll get_inv(ll x,ll y){
		gcd(x,y,DDD,uuu,vvv);
		if(DDD>1) return -1;
		return uuu<0?uuu+y:uuu;
	}		
	
//-------------------------------------------------------
    //Basic operation above
//-------------------------------------------------------
    
    class linear_set{
    public:
	    ul a[lss+9];
	    ul p[lss+9];
	    int num;
		
		linear_set(){ num=0,memset(a,0,sizeof(a));}
		inline void clear(){ num=0,memset(a,0,sizeof(a));}
		inline void Ins(ul x){
			num=0;
			for(int i=lss;i>=0;x^=((x>>i)&1)?a[i]:0,i--) if(((x>>i)&1)&&!a[i]){ a[i]=x; return;}
		}	
		linear_set(int Len,ul *b){ for(int i=1;i<=Len;i++) Ins(b[i]);}
		linear_set(const linear_set &u){ memcpy(a,u.a,sizeof(u.a)),memcpy(p,u.p,sizeof(u.p)),num=u.num;}
		
		inline void Orthogonalization(){
			for(int i=1;i<=lss;i++) if(a[i])
			    for(int j=i-1;j>=0;j--) if(a[j]&&((a[i]>>j)&1)) a[i]^=a[j];
			
			num=0;
			
		    for(int i=0;i<=lss;i++) if(a[i]) p[num++]=a[i];
		}

		friend ostream& operator <<(ostream &o,linear_set &u){
			if(!u.num) u.Orthogonalization();
			W(u.num),puts("");
			
			for(int i=0;i<u.num;i++) printf("%llu ",u.p[i]);
			puts("");
			
			return o;
		}
		
		linear_set operator +(const linear_set &u)const{
			linear_set r=*this;
			for(int i=lss;i>=0;i--) if(u.a[i]) r.Ins(u.a[i]);
			r.Orthogonalization();
			return r;
		}
		
		void operator +=(const linear_set &u){
			for(int i=lss;i>=0;i--) if(u.a[i]) Ins(u.a[i]);
			Orthogonalization();
		}
		
		ul operator ()(ul value){
			if(!num) Orthogonalization();
			ul ans=0,now=0;
			for(int i=num-1;i>=0;i--)
				if((now^p[i])>=value) ans+=((ul)1<<i);
				else now^=p[i];
			if(!value) ans++;
			return ans;
		}
		
		ul operator [](ul rank){
			if(!num) Orthogonalization();
			ul ans=0; rank=((ul)1<<num)-rank;
			for(int i=0;i<num;i++) if(((ul)1<<(ul)i)&rank) ans^=p[i];
			return ans;
		}
		
		inline ul size(){
			if(!num) Orthogonalization();
			return (ul)1<<num;
		}
	};
	
class matrix{
public:
    int a[105][105],n;
     
    inline void clear(){ memset(a,0,sizeof(a));}
    inline void Base(){ clear(); for(int i=1;i<=n;i++) a[i][i]=1;}
    
    matrix(){ n=0,clear();}
    matrix(const int &u){ n=u,clear();}
    matrix(const int &u,int *b) : n(u){
    	for(int i=2;i<=u;i++) a[i][i-1]=1;
    	for(int i=1;i<=u;i++) a[u-i+1][u]=b[i];
	}
    matrix(const matrix &u){
    	n=u.n;
        for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++) a[i][j]=u.a[i][j];
	}
	
     
    inline void input(){
        scanf("%d",&n);
        for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++) scanf("%d",a[i]+j);
    }
    inline void output(){
        for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++) printf("%d ",a[i][j]);
            puts("");
        }
    }
     
    inline void swap(int x,int y){
        for(int i=1;i<=n;i++) swap(a[x][i],a[y][i]);
    }
    inline void add(int from,int tmp,int to){
        for(int i=1;i<=n;i++) ADD(a[to][i],a[from][i]*(ll)tmp%ha);
    }
    inline void mul(int x,int ml){
        for(int i=1;i<=n;i++) a[x][i]=a[x][i]*(ll)ml%ha;
    }
     
    inline int Determinant(){
        int an=1;
        matrix b=*this;
         
        for(int i=1,o,inv;i<=n;i++){
            for(o=i;o<=n;o++) if(b.a[o][i]) break;
            if(o>n) return 0;
            if(o>i){ an=ha-an; b.swap(o,i);}
             
            inv=get_inv(b.a[i][i]);
            for(int j=i+1,tmp;j<=n;j++) if(b.a[j][i])
                tmp=ha-inv*(ll)b.a[j][i]%ha,b.add(i,tmp,j);
             
            an=an*(ll)b.a[i][i]%ha;
        }
         
        return an;
    }
     
    inline matrix ni(){
        matrix b; b.n=n,b.Base();
         
        if(!Determinant()) b.clear();
        else{  
            for(int i=1,o,inv;i<=n;i++){
                for(o=i;o<=n;o++) if(a[o][i]) break;
                if(o>i) swap(o,i),b.swap(o,i);
                 
                inv=get_inv(a[i][i]),mul(i,inv),b.mul(i,inv);
                 
                for(int j=i+1,tmp;j<=n;j++) if(a[j][i])
                    tmp=ha-a[j][i],add(i,tmp,j),b.add(i,tmp,j);
            }
             
            for(int i=n-1;i;i--)
                for(int j=i+1;j<=n;j++) if(a[i][j]) b.add(j,ha-a[i][j],i),add(j,ha-a[i][j],i);
        }
         
        return b;
    }
     
    matrix operator +(const matrix &u){
        for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++) ADD(a[i][j],u.a[i][j]);
        return *this;
    }
     
    matrix operator -(const matrix &u){
        for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++) ADD(a[i][j],ha-u.a[i][j]);
        return *this;
    }
     
    matrix operator *(const matrix &u)const{
        matrix r; r.clear(),r.n=n;
        for(int k=1;k<=n;k++)
            for(int i=1;i<=n;i++)
                for(int j=1;j<=n;j++) ADD(r.a[i][j],a[i][k]*(ll)u.a[k][j]%ha);
        return r;
    }
     
    matrix operator /(matrix &u)const{
        return *this*u.ni();
    }
    
    void operator -=(const matrix &u){ *this=*this-u;} 
    void operator +=(const matrix &u){ *this=*this+u;}     
    void operator *=(const matrix &u){ *this=*this*u;} 
    void operator /=(matrix &u){ *this=*this/u;}     
    
    matrix operator ^(int u)const{
    	matrix r(n),now=*this; r.Base();
        for(;u;u>>=1,now*=now) if(u&1) r*=now;
        return r;
	}
};
    
    int MODD;
    
    template<class T>
    inline T Fun(T x,T y){
    	ll o=x+(ll)y;
    	return o>=MODD?(int)(o-MODD):(int)o;
	}
	
    template<class T>
	inline T tag_cg(T x,T y){
		return Fun(x,y);
	}	
	
    template<class T>
	inline T sum_cg(T x,T y,T a,T b){
		return Fun(x,(int)(y*(ll)a%MODD));
	}	
    
    template<class T,class P>
	inline T summ(T *a,P Begin,P End){
		T an=0;
		for(P i=Begin;i<=End;i++) ADD(an,a[i]);
		return an;
	}
}
#include<complex>
using namespace Number;

#define E complex<double>
const double pi=acos(-1);
const int maxn=700005;

E AA[maxn],BB[maxn];
int rrr[maxn],lll;

inline void fft(E *d,const int f,int m){
    for(int i=0;i<m;i++) if(i<rrr[i]) swap(d[i],d[rrr[i]]);
    for(int i=1;i<m;i<<=1){
        E omega(cos(pi/i),f*sin(pi/i));
        for(int j=0,p=i<<1;j<m;j+=p){
            E now(1,0);
            for(int k=0;k<i;k++,now*=omega){
                E x=d[j+k],y=d[j+k+i]*now;
                d[j+k]=x+y,d[j+k+i]=x-y;
            }
        }
    }
    
    if(f==-1) for(int i=0;i<m;i++) d[i]/=m;
}

inline void fast_mul(int n,E *a,int m,E *b,int& len,E *d){
    if(n*m<=400){
    	len=m+n,fill(d,d+len+1,0);
    	for(int i=0;i<=n;i++)
    	    for(int j=0;j<=m;j++) d[i+j]+=a[i]*b[j];
    	return;
	}
 
    len=m+n,memcpy(AA,a,sizeof(E)*(n+1)),memcpy(BB,b,sizeof(E)*(m+1));
    for(n=1,lll=0;n<=len;n<<=1) lll++;
    for(int i=0;i<n;i++) rrr[i]=(rrr[i>>1]>>1)|((i&1)<<(lll-1));
    
    fft(AA,1,n),fft(BB,1,n);
    for(int i=0;i<n;i++) d[i]=AA[i]*BB[i];
    fft(d,-1,n);
    
    memset(AA,0,sizeof(AA));
    memset(BB,0,sizeof(BB));
}

inline void fast_mul(int& n,E *a,int m,E *b){
    memcpy(AA,a,sizeof(E)*(n+1)),memcpy(BB,b,sizeof(E)*(m+1));
    n+=m;
    for(m=1,lll=0;m<=n;m<<=1) lll++;
    for(int i=0;i<m;i++) rrr[i]=(rrr[i>>1]>>1)|((i&1)<<(lll-1));
    
    fft(AA,1,m),fft(BB,1,m);
    for(int i=0;i<m;i++) a[i]=AA[i]*BB[i];
    fft(a,-1,m);
    
    memset(AA,0,sizeof(AA));
    memset(BB,0,sizeof(BB));
}

const int N=200000;

int dy[N+5],ci[N+5],n;
E a[maxn],b[maxn];
ll ans;

inline void init(){
	for(int i=0,now=1;i<ha-1;i++,now=add(now,now)) dy[now]=i,ci[i]=now;
}

int main(){
	init();
	n=read();
	for(int i=1,now;i<=n;i++){
		now=read();
		if(now==0) continue;
		ans-=mul(now,now),a[dy[now]]+=1,b[dy[now]]+=1;
	}
	int m=ha-2;
	fast_mul(m,a,ha-2,b);
	for(int i=0;i<ha-1;i++) ans+=ci[i]*(ll)((ll)floor(a[i].real()+0.5)+(ll)floor(a[i+ha-1].real()+0.5));
	ans>>=1,cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 40464