fork download
  1. # your code goes here
  2. n=int(input())
  3. arr=list(map(int, input().split()))
  4. k=int(input())
  5. ctr=0
  6. mp={}
  7. for x in arr:
  8. real=x%k
  9. r=(k-real)%k
  10. ctr+=mp.get(r, 0)
  11. mp[real]=mp.get(real, 0)+1
  12. print(ctr)
Success #stdin #stdout 0.06s 14188KB
stdin
6
2 2 5 5 3 3
5
stdout
5