import sys

import numpy as np



n, *aaa = list(map(int, sys.stdin.buffer.read().split()))

aaa = [a for a in aaa if a != 0]

n = len(aaa)



fft_len = 1 << 19



P = 200003

PR = 2

convert = [0] * P

rev_con = [0] * P

rev_con[0] = 1

tmp = 1

for i in range(1, P):

    tmp = tmp * PR % P

    convert[tmp] = i

    rev_con[i] = tmp



ans = 0

f = np.zeros(P)

for a in aaa:

    f[convert[a]] += 1

    ans -= a * a % P



Ff = np.fft.rfft(f, fft_len)

Fff = Ff * Ff

g = np.rint(np.fft.irfft(Fff, fft_len))

for i, c in enumerate(g):

    if c != 0:

        ans += rev_con[i % (P - 1)] * int(c + 1e-6)



print((ans // 2))

import sys

import numpy as np



n, *aaa = list(map(int, sys.stdin.buffer.read().split()))

aaa = [a for a in aaa if a != 0]



fft_len = 1 << 19



P = 200003

PR = 2

convert = [0] * P

rev_con = [0] * P

rev_con[0] = 1

tmp = 1

for i in range(1, P):

    tmp = tmp * PR % P

    convert[tmp] = i

    rev_con[i] = tmp



self_pair_products = 0

f = np.zeros(P)

for a in aaa:

    f[convert[a]] += 1

    self_pair_products += a * a % P



Ff = np.fft.rfft(f, fft_len)

Fff = Ff * Ff

g = np.rint(np.fft.irfft(Fff, fft_len))



g[:P - 1] += g[P - 1:2 * (P - 1)]

g[:fft_len - 2 * (P - 1)] += g[2 * (P - 1):]

g = g[:P - 1].astype(np.int64)

rev_con = np.array(rev_con[:-1])



ans = (g * rev_con).sum() - self_pair_products

print((ans // 2))

import sys
import numpy as np

n, *aaa = list(map(int, sys.stdin.buffer.read().split()))
aaa = [a for a in aaa if a != 0]
n = len(aaa)
fft_len = 1 << 19
P = 200003
PR = 2
convert = [0] * P
rev_con = [0] * P
rev_con[0] = 1
tmp = 1
for i in range(1, P):
    tmp = tmp * PR % P
    convert[tmp] = i
    rev_con[i] = tmp
ans = 0
f = np.zeros(P)
for a in aaa:
    f[convert[a]] += 1
    ans -= a * a % P
Ff = np.fft.rfft(f, fft_len)
Fff = Ff * Ff
g = np.rint(np.fft.irfft(Fff, fft_len))
for i, c in enumerate(g):
    if c != 0:
        ans += rev_con[i % (P - 1)] * int(c + 1e-6)
print((ans // 2))

import sys
import numpy as np

n, *aaa = list(map(int, sys.stdin.buffer.read().split()))
aaa = [a for a in aaa if a != 0]
fft_len = 1 << 19
P = 200003
PR = 2
convert = [0] * P
rev_con = [0] * P
rev_con[0] = 1
tmp = 1
for i in range(1, P):
    tmp = tmp * PR % P
    convert[tmp] = i
    rev_con[i] = tmp
self_pair_products = 0
f = np.zeros(P)
for a in aaa:
    f[convert[a]] += 1
    self_pair_products += a * a % P
Ff = np.fft.rfft(f, fft_len)
Fff = Ff * Ff
g = np.rint(np.fft.irfft(Fff, fft_len))
g[: P - 1] += g[P - 1 : 2 * (P - 1)]
g[: fft_len - 2 * (P - 1)] += g[2 * (P - 1) :]
g = g[: P - 1].astype(np.int64)
rev_con = np.array(rev_con[:-1])
ans = (g * rev_con).sum() - self_pair_products
print((ans // 2))

-n = len(aaa) -ans = 0 +self_pair_products = 0 -    ans -= a * a % P +    self_pair_products += a * a % P -for i, c in enumerate(g): -    if c != 0: -        ans += rev_con[i % (P - 1)] * int(c + 1e-6) +g[: P - 1] += g[P - 1 : 2 * (P - 1)] +g[: fft_len - 2 * (P - 1)] += g[2 * (P - 1) :] +g = g[: P - 1].astype(np.int64) +rev_con = np.array(rev_con[:-1]) +ans = (g * rev_con).sum() - self_pair_products