#include <bits/stdc++.h>
using namespace std;

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template <typename T> T read() {T t; cin >> t; return t;}

void Main() {
  int n = read<int>();
  int m = read<int>();

  vector<int> X(n);
  rep(i, n) X[i] = read<int>();

  vvi Y(m);
  vi C(m);
  forr(x, X) {
    Y[x % m].push_back(x);
    C[x % m]++;
  }

  int ans = 0;

  rep(i, m / 2 + 1) {
    int s = i;
    int t = m - s;
    if (s == 0 || s == t) {
      ans += C[s] / 2;
      continue;
    }
    if (C[t] > C[s]) swap(s, t);

    // |t| <= |s|

    ans += C[t];

    int use_in_s = C[s] - C[t];
    use_in_s -= use_in_s % 2;
    {
      map<int, int> co;
      forr(y, Y[s]) co[y]++;
      forr(yc, co) {
        int c = yc.snd;
        if (c >= 2) {
          int u = min(c / 2 * 2, use_in_s);
          ans += u / 2;
          use_in_s -= u;
        }
      }
    }
  }

  cout << ans << endl;
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }

### Prompt

Create a solution in cpp for 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 _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template <typename T> T read() {T t; cin >> t; return t;}

void Main() {
  int n = read<int>();
  int m = read<int>();

  vector<int> X(n);
  rep(i, n) X[i] = read<int>();

  vvi Y(m);
  vi C(m);
  forr(x, X) {
    Y[x % m].push_back(x);
    C[x % m]++;
  }

  int ans = 0;

  rep(i, m / 2 + 1) {
    int s = i;
    int t = m - s;
    if (s == 0 || s == t) {
      ans += C[s] / 2;
      continue;
    }
    if (C[t] > C[s]) swap(s, t);

    // |t| <= |s|

    ans += C[t];

    int use_in_s = C[s] - C[t];
    use_in_s -= use_in_s % 2;
    {
      map<int, int> co;
      forr(y, Y[s]) co[y]++;
      forr(yc, co) {
        int c = yc.snd;
        if (c >= 2) {
          int u = min(c / 2 * 2, use_in_s);
          ans += u / 2;
          use_in_s -= u;
        }
      }
    }
  }

  cout << ans << endl;
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }

```