/* -*- coding: utf-8 -*- * * 1972.cc: No.1972 Modulo Set - yukicoder */ #include #include #include using namespace std; /* constant */ const int MAX_N = 100000; /* typedef */ typedef long long ll; typedef map mli; /* global variables */ ll as[MAX_N]; /* subroutines */ /* main */ int main() { int n; ll m; scanf("%d%lld", &n, &m); mli acs; for (int i = 0; i < n; i++) { ll ai; scanf("%lld", &ai); acs[ai % m]++; } int sum = 0; for (auto ac: acs) { ll a = ac.first, b = m - a; int c = ac.second; if (a == 0 || a * 2 == m) sum++; else { mli::iterator mit = acs.find(b); if (mit == acs.end()) sum += c; else if (a < b) sum += max(c, mit->second); } } printf("%d\n", sum); return 0; }