#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define inf 1000000005
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))
#define mod 10007
#define sz(a) ((ll)(a).size())

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcount(s);}
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define eps 1e-9
typedef pair<int, int> II;
typedef pair<ll, ll> LL;
template<class T> T gcd(T a, T b){ T r; while (b != 0) { r = a % b; a = b; b = r; } return a;}
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define PI (2 * acos((ld)0))
#define linf (1ll << 60)
#define y1 y32432
#define y0 y435346

#define maxn 400005

int n, m;
int a[maxn], num[maxn];

int main()
{
//	gen();
//	freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    int res = 0;
    cin >> n >> m;
    ms(a, 0); ms(num, 0);
    For(i, 1, n){
    	int x;
    	cin >> x;
    	a[x % m]++;
    	num[x]++;
    }

    for(int i = 0; i + i <= m; i++){
    	if((i + i) % m == 0){
    		int u = a[i] / 2;
    		res += u;
    		a[i] -= u + u;
    	} else{
    		int j = m - i;
    		int d = min(a[i], a[j]);
    		res += d;
    		a[i] -= d;
    		a[j] -= d;
    	}
//    	cout << i << " " << res << endl;
    }

    For(i, 0, maxn) if(num[i]){
    	int u = min(a[i % m], num[i]) / 2;
    	res += u;
    	a[i % m] -= u + u;
    }

    cout << res << endl;

    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
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define inf 1000000005
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))
#define mod 10007
#define sz(a) ((ll)(a).size())

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcount(s);}
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define eps 1e-9
typedef pair<int, int> II;
typedef pair<ll, ll> LL;
template<class T> T gcd(T a, T b){ T r; while (b != 0) { r = a % b; a = b; b = r; } return a;}
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define PI (2 * acos((ld)0))
#define linf (1ll << 60)
#define y1 y32432
#define y0 y435346

#define maxn 400005

int n, m;
int a[maxn], num[maxn];

int main()
{
//	gen();
//	freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    int res = 0;
    cin >> n >> m;
    ms(a, 0); ms(num, 0);
    For(i, 1, n){
    	int x;
    	cin >> x;
    	a[x % m]++;
    	num[x]++;
    }

    for(int i = 0; i + i <= m; i++){
    	if((i + i) % m == 0){
    		int u = a[i] / 2;
    		res += u;
    		a[i] -= u + u;
    	} else{
    		int j = m - i;
    		int d = min(a[i], a[j]);
    		res += d;
    		a[i] -= d;
    		a[j] -= d;
    	}
//    	cout << i << " " << res << endl;
    }

    For(i, 0, maxn) if(num[i]){
    	int u = min(a[i % m], num[i]) / 2;
    	res += u;
    	a[i % m] -= u + u;
    }

    cout << res << endl;

    return 0;
}

```