#include <bits/stdc++.h>
using namespace std;
#define DEBUG_MODE
#define endl '\n'
#ifdef DEBUG_MODE
#define DEBUG(X) debug_func(X, #X)
#define DEBUG_ENDL endl
#define DEBUG_SEPARATOR_LINE cout<<"=================\n"
#else
#define DEBUG(X) 0
#define DEBUG_ENDL 0
#define DEBUG_SEPARATOR_LINE 0
#endif
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
#define DEBUG_ENDL_S(S) ((S).size() ? "\n" : "")
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); }
template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
void debug_func_preffix(const string &s) { if(s.size()) cout << s << " = "; }
template <typename T>
void debug_func(const T &t, const string &s = "") {
    debug_func_preffix(s);
    cout << t << DEBUG_ENDL_S(s);
}
template <typename T, typename U>
void debug_func(const P<T, U> &p, const string &s = "") {
    debug_func_preffix(s);
    cout << "(";
    debug_func(p.first);
    cout << ", ";
    debug_func(p.second);
    cout << ")" << DEBUG_ENDL_S(s);
}
template <typename T>
void debug_func(const V<T> &v, const string &s = "") {
    for(ll i = 0; i < v.size(); i++) {
        string t = s + "[" + to_string(i) + "]";
        debug_func(v[i], t);
    }
}

int main() {
    ll N, M;
    cin >> N >> M;
    V<ll> X(N);
    for(ll &e : X) cin >> e;
    VV<ll> modv(M);
    for(ll i = 0; i < N; i++) {
        ll m = X[i] % M;
        modv[m].push_back(X[i]);
    }
    V<ll> rest(M, 0);
    ll ans = 0;
    for(ll i = 0; ; i++) {
        ll j = (M - i) % M;
        if(j < i) break;
        if(i == j) {
            ans += modv[i].size() / 2;
            rest[i] = modv[i].size() % 2;
        } else {
            ll idx =  (modv[i].size() < modv[j].size() ? i : j);
            ll ridx = (modv[i].size() < modv[j].size() ? j : i);
            ans += modv[idx].size();
            rest[ridx] = modv[ridx].size() - modv[idx].size();
        }
    }
    for(ll i = 0; i < M; i++) {
        map<ll, ll> cnt;
        for(ll e : modv[i]) cnt[e]++;
        ll v = 0;
        for(const auto &e : cnt) v += e.second / 2;
        ans += min(rest[i] / 2, v);
    }
    cout << ans << 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 DEBUG_MODE
#define endl '\n'
#ifdef DEBUG_MODE
#define DEBUG(X) debug_func(X, #X)
#define DEBUG_ENDL endl
#define DEBUG_SEPARATOR_LINE cout<<"=================\n"
#else
#define DEBUG(X) 0
#define DEBUG_ENDL 0
#define DEBUG_SEPARATOR_LINE 0
#endif
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
#define DEBUG_ENDL_S(S) ((S).size() ? "\n" : "")
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); }
template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
void debug_func_preffix(const string &s) { if(s.size()) cout << s << " = "; }
template <typename T>
void debug_func(const T &t, const string &s = "") {
    debug_func_preffix(s);
    cout << t << DEBUG_ENDL_S(s);
}
template <typename T, typename U>
void debug_func(const P<T, U> &p, const string &s = "") {
    debug_func_preffix(s);
    cout << "(";
    debug_func(p.first);
    cout << ", ";
    debug_func(p.second);
    cout << ")" << DEBUG_ENDL_S(s);
}
template <typename T>
void debug_func(const V<T> &v, const string &s = "") {
    for(ll i = 0; i < v.size(); i++) {
        string t = s + "[" + to_string(i) + "]";
        debug_func(v[i], t);
    }
}

int main() {
    ll N, M;
    cin >> N >> M;
    V<ll> X(N);
    for(ll &e : X) cin >> e;
    VV<ll> modv(M);
    for(ll i = 0; i < N; i++) {
        ll m = X[i] % M;
        modv[m].push_back(X[i]);
    }
    V<ll> rest(M, 0);
    ll ans = 0;
    for(ll i = 0; ; i++) {
        ll j = (M - i) % M;
        if(j < i) break;
        if(i == j) {
            ans += modv[i].size() / 2;
            rest[i] = modv[i].size() % 2;
        } else {
            ll idx =  (modv[i].size() < modv[j].size() ? i : j);
            ll ridx = (modv[i].size() < modv[j].size() ? j : i);
            ans += modv[idx].size();
            rest[ridx] = modv[ridx].size() - modv[idx].size();
        }
    }
    for(ll i = 0; i < M; i++) {
        map<ll, ll> cnt;
        for(ll e : modv[i]) cnt[e]++;
        ll v = 0;
        for(const auto &e : cnt) v += e.second / 2;
        ans += min(rest[i] / 2, v);
    }
    cout << ans << endl;
    return 0;
}

```