#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N,M;
	cin >> N >> M;
	
	vector< map<int,int> > num(M);
	map<int,int> amaSum;
	int X;
	for(int i=0;i<N;++i){
		cin >> X;
		num[X%M][X]++;
		amaSum[X%M]++;
	}

	int ans = 0;
	map<int,int>::iterator itr,end;

	for(int i=0;i<M;++i){
		int ter = M-i;
		if( ter < i ) break;

		if( i == 0 ){
			ans += amaSum[0]/2;
		}else if(i == ter){
			int A = amaSum[i];
			ans += A/2;
		}else{
			int A = amaSum[i];
			int B = amaSum[ter];
			if( A > B ){
				int nokori = A-B;
				ans += B;
				itr = num[i].begin();
				end = num[i].end();
				for(;itr!=end && nokori;++itr){
					int sub = (itr->second)/2;
					int res = ( min(nokori,sub*2) ) /2 ;
					ans += res;
					nokori -= res*2;
				}
			}else if( B > A ){
				//A > Bと同等の処理
				int nokori = B-A;
				ans += A;
				itr = num[ter].begin();
				end = num[ter].end();
				for(;itr!=end && nokori;++itr){
					int sub = (itr->second)/2;
					int res = ( min(nokori,sub*2) ) /2 ;
					ans += res;
					nokori -= res*2;
				}
			}else{//A==B
				ans += A;
			}
		}
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

### Prompt

Your challenge is to write 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
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N,M;
	cin >> N >> M;
	
	vector< map<int,int> > num(M);
	map<int,int> amaSum;
	int X;
	for(int i=0;i<N;++i){
		cin >> X;
		num[X%M][X]++;
		amaSum[X%M]++;
	}

	int ans = 0;
	map<int,int>::iterator itr,end;

	for(int i=0;i<M;++i){
		int ter = M-i;
		if( ter < i ) break;

		if( i == 0 ){
			ans += amaSum[0]/2;
		}else if(i == ter){
			int A = amaSum[i];
			ans += A/2;
		}else{
			int A = amaSum[i];
			int B = amaSum[ter];
			if( A > B ){
				int nokori = A-B;
				ans += B;
				itr = num[i].begin();
				end = num[i].end();
				for(;itr!=end && nokori;++itr){
					int sub = (itr->second)/2;
					int res = ( min(nokori,sub*2) ) /2 ;
					ans += res;
					nokori -= res*2;
				}
			}else if( B > A ){
				//A > Bと同等の処理
				int nokori = B-A;
				ans += A;
				itr = num[ter].begin();
				end = num[ter].end();
				for(;itr!=end && nokori;++itr){
					int sub = (itr->second)/2;
					int res = ( min(nokori,sub*2) ) /2 ;
					ans += res;
					nokori -= res*2;
				}
			}else{//A==B
				ans += A;
			}
		}
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

```