import numpy as np



if __name__ == "__main__":

	N=int(eval(input()))

	A=list(map(int,input().split()))



	P=200_003

	rootP=2



	order=[1]

	x=rootP

	while x!=1:

		order.append(x)

		x *= rootP

		x %= P



	ORDER_SIZE=len(order)	# 200_002



	where=np.zeros(P,int)

	for i in range(ORDER_SIZE):

		where[ order[i] ] = i



	prevCnt = np.zeros(P,int)

	resCnt = np.zeros(P,int)

	for n in range(N):

		if A[n] != 0:

			prevCnt[ where[A[n]] ] += 1

			resCnt[ (A[n] * A[n]) % P ] -= 1



	N_=1

	while N_ < 2*len(prevCnt): N_ *= 2

	nf = np.zeros(N_,int)

	nf[:len(prevCnt)]=prevCnt

	nf=np.fft.rfft(nf)

	fftRes = np.rint( np.fft.irfft(nf*nf) )



	for r in range(len(fftRes)):

		if fftRes[r] != 0:

			resCnt[ order[ r % ORDER_SIZE ] ] += fftRes[r]



	ans = 0

	for p in range(P):

		if resCnt[p] != 0:

			ans += (resCnt[p] // 2) * p



	print(ans)

import numpy as np





class FastFourierTransform:

	"""FFT

	"""



	def multiply(self, F,G):

		""" multiply by FFT

		"""

		N=1

		# 1.N > deg(g) + deg(h)となる2の冪乗を選ぶ

		while N < len(F) + len(G):

			N *= 2

		# 2. 離散フーリエ変換の計算

		nf = np.zeros(N,int)

		nf[:len(F)]=F

		ng = np.zeros(N,int)

		ng[:len(G)]=G

		nf=np.fft.fft(nf)

		ng=np.fft.fft(ng)

		# for n in range(N):

			# nf[n] *= ng[n]

		nf *= ng



		# 3. 離散フーリエ逆変換

		nf=np.fft.ifft(nf)



		ans = np.zeros(N,int)

		for n in range(N):

			# 係数を1/N倍 => np.fftの場合、すでに実行済

			#ans.append( round(nf[n].real / N) )

			ans[n] = int(nf[n].real + 0.5)



		return ans



if __name__ == "__main__":

	N=int(eval(input()))

	A=list(map(int,input().split()))



	P=200_003

	rootP=2



	# order of 1 to P-1 after fft

	order=[1]

	x=rootP

	while x!=1:

		order.append(x)

		x *= rootP

		x %= P



	ORDER_SIZE=len(order)	# 200_002



	# create order index

	where=np.zeros(P,int)

	for i in range(ORDER_SIZE):

		where[ order[i] ] = i



	# count non zero items

	prevCnt = np.zeros(P,int)

	resCnt = np.zeros(P,int)

	# prevCnt2 = [ 0 for _ in range(P)]

	# resCnt = [ 0 for _ in range(P)]

	for n in range(N):

		if A[n] != 0:

			prevCnt[ where[A[n]] ] += 1

			# prevCnt2[ where[A[n]] ] += 1

			# remove Ax * Ax pattern count

			resCnt[ (A[n] * A[n]) % P ] -= 1



	# fft to cnt (calc nC2 and all Ax * Ay)

	clsFFT = FastFourierTransform()

	fftRes = clsFFT.multiply(prevCnt,prevCnt)



	for r in range(len(fftRes)):

		if fftRes[r] != 0:

			# get result(Ax*Ay==resCnt.index) Cnt by summary fftRes

			resCnt[ order[ r % ORDER_SIZE ] ] += fftRes[r]



	ans = 0

	for p in range(P):

		if resCnt[p] != 0:

			# print(p,resCnt[p])

			# remove j <= i pattern count 

			# and

			# calc summary value((Ax * Ay cnt) * (Ax * Ay)))

			ans += (resCnt[p] // 2) * p



	print(ans)













import numpy as np

if __name__ == "__main__":
    N = int(eval(input()))
    A = list(map(int, input().split()))
    P = 200_003
    rootP = 2
    order = [1]
    x = rootP
    while x != 1:
        order.append(x)
        x *= rootP
        x %= P
    ORDER_SIZE = len(order)  # 200_002
    where = np.zeros(P, int)
    for i in range(ORDER_SIZE):
        where[order[i]] = i
    prevCnt = np.zeros(P, int)
    resCnt = np.zeros(P, int)
    for n in range(N):
        if A[n] != 0:
            prevCnt[where[A[n]]] += 1
            resCnt[(A[n] * A[n]) % P] -= 1
    N_ = 1
    while N_ < 2 * len(prevCnt):
        N_ *= 2
    nf = np.zeros(N_, int)
    nf[: len(prevCnt)] = prevCnt
    nf = np.fft.rfft(nf)
    fftRes = np.rint(np.fft.irfft(nf * nf))
    for r in range(len(fftRes)):
        if fftRes[r] != 0:
            resCnt[order[r % ORDER_SIZE]] += fftRes[r]
    ans = 0
    for p in range(P):
        if resCnt[p] != 0:
            ans += (resCnt[p] // 2) * p
    print(ans)

import numpy as np


class FastFourierTransform:
    """FFT"""

    def multiply(self, F, G):
        """multiply by FFT"""
        N = 1
        # 1.N > deg(g) + deg(h)となる2の冪乗を選ぶ
        while N < len(F) + len(G):
            N *= 2
        # 2. 離散フーリエ変換の計算
        nf = np.zeros(N, int)
        nf[: len(F)] = F
        ng = np.zeros(N, int)
        ng[: len(G)] = G
        nf = np.fft.fft(nf)
        ng = np.fft.fft(ng)
        # for n in range(N):
        # nf[n] *= ng[n]
        nf *= ng
        # 3. 離散フーリエ逆変換
        nf = np.fft.ifft(nf)
        ans = np.zeros(N, int)
        for n in range(N):
            # 係数を1/N倍 => np.fftの場合、すでに実行済
            # ans.append( round(nf[n].real / N) )
            ans[n] = int(nf[n].real + 0.5)
        return ans


if __name__ == "__main__":
    N = int(eval(input()))
    A = list(map(int, input().split()))
    P = 200_003
    rootP = 2
    # order of 1 to P-1 after fft
    order = [1]
    x = rootP
    while x != 1:
        order.append(x)
        x *= rootP
        x %= P
    ORDER_SIZE = len(order)  # 200_002
    # create order index
    where = np.zeros(P, int)
    for i in range(ORDER_SIZE):
        where[order[i]] = i
    # count non zero items
    prevCnt = np.zeros(P, int)
    resCnt = np.zeros(P, int)
    # prevCnt2 = [ 0 for _ in range(P)]
    # resCnt = [ 0 for _ in range(P)]
    for n in range(N):
        if A[n] != 0:
            prevCnt[where[A[n]]] += 1
            # prevCnt2[ where[A[n]] ] += 1
            # remove Ax * Ax pattern count
            resCnt[(A[n] * A[n]) % P] -= 1
    # fft to cnt (calc nC2 and all Ax * Ay)
    clsFFT = FastFourierTransform()
    fftRes = clsFFT.multiply(prevCnt, prevCnt)
    for r in range(len(fftRes)):
        if fftRes[r] != 0:
            # get result(Ax*Ay==resCnt.index) Cnt by summary fftRes
            resCnt[order[r % ORDER_SIZE]] += fftRes[r]
    ans = 0
    for p in range(P):
        if resCnt[p] != 0:
            # print(p,resCnt[p])
            # remove j <= i pattern count
            # and
            # calc summary value((Ax * Ay cnt) * (Ax * Ay)))
            ans += (resCnt[p] // 2) * p
    print(ans)

+ + +class FastFourierTransform: +    """FFT""" + +    def multiply(self, F, G): +        """multiply by FFT""" +        N = 1 +        # 1.N > deg(g) + deg(h)となる2の冪乗を選ぶ +        while N < len(F) + len(G): +            N *= 2 +        # 2. 離散フーリエ変換の計算 +        nf = np.zeros(N, int) +        nf[: len(F)] = F +        ng = np.zeros(N, int) +        ng[: len(G)] = G +        nf = np.fft.fft(nf) +        ng = np.fft.fft(ng) +        # for n in range(N): +        # nf[n] *= ng[n] +        nf *= ng +        # 3. 離散フーリエ逆変換 +        nf = np.fft.ifft(nf) +        ans = np.zeros(N, int) +        for n in range(N): +            # 係数を1/N倍 => np.fftの場合、すでに実行済 +            # ans.append( round(nf[n].real / N) ) +            ans[n] = int(nf[n].real + 0.5) +        return ans + +    # order of 1 to P-1 after fft +    # create order index +    # count non zero items +    # prevCnt2 = [ 0 for _ in range(P)] +    # resCnt = [ 0 for _ in range(P)] +            # prevCnt2[ where[A[n]] ] += 1 +            # remove Ax * Ax pattern count -    N_ = 1 -    while N_ < 2 * len(prevCnt): -        N_ *= 2 -    nf = np.zeros(N_, int) -    nf[: len(prevCnt)] = prevCnt -    nf = np.fft.rfft(nf) -    fftRes = np.rint(np.fft.irfft(nf * nf)) +    # fft to cnt (calc nC2 and all Ax * Ay) +    clsFFT = FastFourierTransform() +    fftRes = clsFFT.multiply(prevCnt, prevCnt) +            # get result(Ax*Ay==resCnt.index) Cnt by summary fftRes +            # print(p,resCnt[p]) +            # remove j <= i pattern count +            # and +            # calc summary value((Ax * Ay cnt) * (Ax * Ay)))