from numpy import*

n,*x=[int32(t.split())for t in open(0)]

print((sum(sum(linalg.norm(i-x,2,1)%1==0)for i in x)-n[0]>>1))
from numpy import*

n,*x=[int32(t.split())for t in open(0)]

print((sum(triu([linalg.norm(i-x,2,1)%1==0for i in x],1))))
from numpy import *

n, *x = [int32(t.split()) for t in open(0)]
print((sum(sum(linalg.norm(i - x, 2, 1) % 1 == 0) for i in x) - n[0] >> 1))

from numpy import *

n, *x = [int32(t.split()) for t in open(0)]
print((sum(triu([linalg.norm(i - x, 2, 1) % 1 == 0 for i in x], 1))))

-print((sum(sum(linalg.norm(i - x, 2, 1) % 1 == 0) for i in x) - n[0] >> 1)) +print((sum(triu([linalg.norm(i - x, 2, 1) % 1 == 0 for i in x], 1))))