#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> x(n), d(100010), r(m), p(m);
    rep(i, 0, n){
        cin >> x[i];
        d[x[i]]++;
        r[x[i] % m]++;
    }
    int ans = 0;
    rep(i, 0, 100010){
        // ans += d[i] / 2;
        // r[i % m] -= (d[i] / 2) * 2;
        p[i % m] += d[i] / 2;
    }
    // rep(i, 0, m) cout << r[i] << endl;
    rep(i, 0, m){
        int op = (m - i) % m;
        if(i > op) break;
        if(i == op){
            ans += r[i] / 2; r[i] %= 2;
        }else{
            int pr = min(r[i], r[op]);
            ans += pr;
            r[i] -= pr;
            r[op] -= pr;
            ans += min(p[i], r[i] / 2);
            ans += min(p[op], r[op] / 2);
            // cout << i << " " << op << " " << pr << " " << r[i]  << " " << r[op]  << endl;
        }
    }
    cout << ans << endl;
}
### 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>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> x(n), d(100010), r(m), p(m);
    rep(i, 0, n){
        cin >> x[i];
        d[x[i]]++;
        r[x[i] % m]++;
    }
    int ans = 0;
    rep(i, 0, 100010){
        // ans += d[i] / 2;
        // r[i % m] -= (d[i] / 2) * 2;
        p[i % m] += d[i] / 2;
    }
    // rep(i, 0, m) cout << r[i] << endl;
    rep(i, 0, m){
        int op = (m - i) % m;
        if(i > op) break;
        if(i == op){
            ans += r[i] / 2; r[i] %= 2;
        }else{
            int pr = min(r[i], r[op]);
            ans += pr;
            r[i] -= pr;
            r[op] -= pr;
            ans += min(p[i], r[i] / 2);
            ans += min(p[op], r[op] / 2);
            // cout << i << " " << op << " " << pr << " " << r[i]  << " " << r[op]  << endl;
        }
    }
    cout << ans << endl;
}
```