#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>








const int N=1e5+10;
ll n,m,x,c[N],c2[N],mn,mx,res;






void solve()
{
	cin>>n>>m;
	for(int i=0;i<=m;i++)c[i]=0;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		c[x%m]++;
		c2[x]++;
	}
	res=(c[0]/2);
	if(m%2==0)res+=c[m/2]/2;
	for(int i=1,j=m-1;i*2<m;i++,j--)
	{
		mn=min(c[i],c[j]);
		res+=mn;
		c[i]-=mn;
		c[j]-=mn;
	}
	for(int i=1;i+4<N;i++)
	{
		if(i%m==0||(i%m)*2==m)continue;
		mn=min(c[i%m]/2,c2[i]/2);
		res+=mn;
		c[i%m]-=mn*2;
	}
	cout<<res<<"\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}
### Prompt

Generate a CPP solution to the following problem:

Takahashi is playing with N cards.

The i-th card has an integer X_i on it.

Takahashi is trying to create as many pairs of cards as possible satisfying one of the following conditions:

* The integers on the two cards are the same.
* The sum of the integers on the two cards is a multiple of M.



Find the maximum number of pairs that can be created.

Note that a card cannot be used in more than one pair.

Constraints

* 2≦N≦10^5
* 1≦M≦10^5
* 1≦X_i≦10^5

Input

The input is given from Standard Input in the following format:


N M
X_1 X_2 ... X_N


Output

Print the maximum number of pairs that can be created.

Examples

Input

7 5
3 1 4 1 5 9 2


Output

3


Input

15 10
1 5 6 10 11 11 11 20 21 25 25 26 99 99 99


Output

6

### Response

```cpp
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>








const int N=1e5+10;
ll n,m,x,c[N],c2[N],mn,mx,res;






void solve()
{
	cin>>n>>m;
	for(int i=0;i<=m;i++)c[i]=0;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		c[x%m]++;
		c2[x]++;
	}
	res=(c[0]/2);
	if(m%2==0)res+=c[m/2]/2;
	for(int i=1,j=m-1;i*2<m;i++,j--)
	{
		mn=min(c[i],c[j]);
		res+=mn;
		c[i]-=mn;
		c[j]-=mn;
	}
	for(int i=1;i+4<N;i++)
	{
		if(i%m==0||(i%m)*2==m)continue;
		mn=min(c[i%m]/2,c2[i]/2);
		res+=mn;
		c[i%m]-=mn*2;
	}
	cout<<res<<"\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}
```