/*
*/

#define _CRT_SECURE_NO_WARNINGS

#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds

#define eps 1e-6
#define M_PI 3.141592653589793
#define bs 1000000007
#define bsize 337

using namespace std;

const int INF = 1e9;
const int N = 201231;

int n, m, cnt[N];
int odds[N];
int ans;
int evens[N];

int main(){
	//freopen("fabro.in","r",stdin);
	//freopen("fabro.out","w",stdout);
	//freopen("F:/input.txt", "r", stdin);
	//freopen("F:/output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	//cin.tie(0);
	
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
	{
		int x;
		cin >> x;
		cnt[x]++;
	}

	for (int i = 1; i <= 100000; i++)
	{
		if (cnt[i] % 2)
		{
			odds[i%m]++;
		}
		evens[i%m] += cnt[i] - cnt[i] % 2;
	}

	for (int i = 0; i < m; i++)
	{
		int othr = m - i;
		othr %= m;
		if (othr < i)
			continue;

		if (i != othr)
		{
			int here = min(odds[i], odds[othr]);
			ans += here;
			odds[i] -= here;
			odds[othr] -= here;
		}
		else
			ans += odds[i] / 2,
			odds[i] %= 2;
	}

	for (int i = 0; i < m; i++)
	{
		int othr = m - i;
		othr %= m;
		int can_add = min(odds[i], evens[othr]);
		can_add -= can_add % 2;
		ans += can_add;
		odds[i] -= can_add;
		evens[othr] -= can_add;
	}

	for (int i = 0; i <m; i++)
		ans += evens[i] / 2;

	cout << ans << endl;

	cin.get(); cin.get();
	return 0;
}
### Prompt

Your task is to create 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
/*
*/

#define _CRT_SECURE_NO_WARNINGS

#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds

#define eps 1e-6
#define M_PI 3.141592653589793
#define bs 1000000007
#define bsize 337

using namespace std;

const int INF = 1e9;
const int N = 201231;

int n, m, cnt[N];
int odds[N];
int ans;
int evens[N];

int main(){
	//freopen("fabro.in","r",stdin);
	//freopen("fabro.out","w",stdout);
	//freopen("F:/input.txt", "r", stdin);
	//freopen("F:/output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	//cin.tie(0);
	
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
	{
		int x;
		cin >> x;
		cnt[x]++;
	}

	for (int i = 1; i <= 100000; i++)
	{
		if (cnt[i] % 2)
		{
			odds[i%m]++;
		}
		evens[i%m] += cnt[i] - cnt[i] % 2;
	}

	for (int i = 0; i < m; i++)
	{
		int othr = m - i;
		othr %= m;
		if (othr < i)
			continue;

		if (i != othr)
		{
			int here = min(odds[i], odds[othr]);
			ans += here;
			odds[i] -= here;
			odds[othr] -= here;
		}
		else
			ans += odds[i] / 2,
			odds[i] %= 2;
	}

	for (int i = 0; i < m; i++)
	{
		int othr = m - i;
		othr %= m;
		int can_add = min(odds[i], evens[othr]);
		can_add -= can_add % 2;
		ans += can_add;
		odds[i] -= can_add;
		evens[othr] -= can_add;
	}

	for (int i = 0; i <m; i++)
		ans += evens[i] / 2;

	cout << ans << endl;

	cin.get(); cin.get();
	return 0;
}
```