#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll mod = 0;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n, m;
int a[200000];
int b[200000];
vector<int>c[200000];
signed main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		int u = read();
		a[u]++;
		b[u % m]++;
	}
	for (int i = 1; i <= 100000; i++) {
		if (a[i] > 0) c[i % m].push_back(a[i]);
	}
	int ans = 0;
	for (int i = 0; i < m; i++) {
		if (i == (m - i) % m) {
			ans += b[i] / 2;
			b[i] = 0;
			continue;
		}
		if ((m - i) - i > 0) {
			ans += min(b[i], b[m - i]);
			//余りのWAがMの時に成立
			//小さいほうは全部使う
			int t = min(b[i], b[m - i]);
			b[i] = t; b[m - i] = t;
		}
	}
	b[0] = 0;
	for (int i = 0; i < m; i++) {
		if (i == (m - i) % m) continue;
		int res = 0;
		for (int j = 0; j < c[i].size(); j++) {
			if (b[i] > 0 && c[i][j] % 2 == 1) {
				b[i]--;
				c[i][j]--;
			}
			res += c[i][j] / 2;
		}
		res -= ceil(b[i] / 2.0);
		ans += res;
	}
	cout << ans << endl;
}
### 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<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll mod = 0;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n, m;
int a[200000];
int b[200000];
vector<int>c[200000];
signed main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		int u = read();
		a[u]++;
		b[u % m]++;
	}
	for (int i = 1; i <= 100000; i++) {
		if (a[i] > 0) c[i % m].push_back(a[i]);
	}
	int ans = 0;
	for (int i = 0; i < m; i++) {
		if (i == (m - i) % m) {
			ans += b[i] / 2;
			b[i] = 0;
			continue;
		}
		if ((m - i) - i > 0) {
			ans += min(b[i], b[m - i]);
			//余りのWAがMの時に成立
			//小さいほうは全部使う
			int t = min(b[i], b[m - i]);
			b[i] = t; b[m - i] = t;
		}
	}
	b[0] = 0;
	for (int i = 0; i < m; i++) {
		if (i == (m - i) % m) continue;
		int res = 0;
		for (int j = 0; j < c[i].size(); j++) {
			if (b[i] > 0 && c[i][j] % 2 == 1) {
				b[i]--;
				c[i][j]--;
			}
			res += c[i][j] / 2;
		}
		res -= ceil(b[i] / 2.0);
		ans += res;
	}
	cout << ans << endl;
}
```