#Lutece2350. Akane

Akane

Migrated from Lutece 2350 Akane

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

给定长度为n的序列A,重新排列A,使有尽可能多的相邻数对,满足(Ai+Ai+1)( A_i + A_{i+1} ) % m=0m = 0

Input

输入的第一行包含两个整数n(1<=n<=1,000,000)和m(2<=m<=100),分别表示序列的长度n和常数m

第二行包含n个整数,表示序列A(1<=Ai<=100)

Output

输出一个数字,表示重新排列后满足上述条件的相邻数对的数目

Samples

5 2
1 2 3 4 5
3

Resources

电子科技大学第十届ACM趣味程序设计竞赛