#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
int a[SIZE],pn[SIZE],sn[SIZE];
int main(){
    DRII(N,M);
    REP(i,N)RI(a[i]);
    sort(a,a+N);
    for(int i=0,j;i<N;i=j){
        for(j=i+1;j<N&&a[j]==a[i];j++);
        pn[a[i]%M]+=(j-i)/2;
        sn[a[i]%M]+=(j-i)%2;
    }
    int an=0;
    an+=(pn[0]*2+sn[0])/2;
    if(M%2==0)
        an+=(pn[M/2]*2+sn[M/2])/2;
    for(int i=1;i<M-i;i++){
        if(pn[i]*2+sn[i]<pn[M-i]*2+sn[M-i]){
            an+=pn[i]*2+sn[i]+min(pn[M-i],(pn[M-i]*2+sn[M-i]-(pn[i]*2+sn[i]))/2);
        }
        else{
            an+=pn[M-i]*2+sn[M-i]+min(pn[i],(pn[i]*2+sn[i]-(pn[M-i]*2+sn[M-i]))/2);
        }
    }
    return 0*printf("%d\n",an);
}

### Prompt

Please formulate 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>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
int a[SIZE],pn[SIZE],sn[SIZE];
int main(){
    DRII(N,M);
    REP(i,N)RI(a[i]);
    sort(a,a+N);
    for(int i=0,j;i<N;i=j){
        for(j=i+1;j<N&&a[j]==a[i];j++);
        pn[a[i]%M]+=(j-i)/2;
        sn[a[i]%M]+=(j-i)%2;
    }
    int an=0;
    an+=(pn[0]*2+sn[0])/2;
    if(M%2==0)
        an+=(pn[M/2]*2+sn[M/2])/2;
    for(int i=1;i<M-i;i++){
        if(pn[i]*2+sn[i]<pn[M-i]*2+sn[M-i]){
            an+=pn[i]*2+sn[i]+min(pn[M-i],(pn[M-i]*2+sn[M-i]-(pn[i]*2+sn[i]))/2);
        }
        else{
            an+=pn[M-i]*2+sn[M-i]+min(pn[i],(pn[i]*2+sn[i]-(pn[M-i]*2+sn[M-i]))/2);
        }
    }
    return 0*printf("%d\n",an);
}

```