#if !__INCLUDE_LEVEL__ #include __FILE__ struct Eratosthenes { // テーブル vector isprime; // 整数 i を割り切る最小の素数 vector minfactor; // コンストラクタで篩を回す Eratosthenes(int N) : isprime(N+1, true), minfactor(N+1, -1) { // 1 は予めふるい落としておく isprime[1] = false; minfactor[1] = 1; // 篩 for (int p = 2; p <= N; ++p) { // すでに合成数であるものはスキップする if (!isprime[p]) continue; // p についての情報更新 minfactor[p] = p; // p 以外の p の倍数から素数ラベルを剥奪 for (int q = p * 2; q <= N; q += p) { // q は合成数なのでふるい落とす isprime[q] = false; // q は p で割り切れる旨を更新 if (minfactor[q] == -1) minfactor[q] = p; } } } // 高速素因数分解 // pair (素因子, 指数) の vector を返す vector> factorize(int n) { vector> res; while (n > 1) { int p = minfactor[n]; int exp = 0; // n で割り切れる限り割る while (minfactor[n] == p) { n /= p; ++exp; } res.emplace_back(p, exp); } return res; } // 高速約数列挙 vector divisors(int n) { vector res({1}); // n を素因数分解 (メンバ関数使用) auto pf = factorize(n); // 約数列挙 for (auto p : pf) { int s = (int)res.size(); for (int i = 0; i < s; ++i) { int v = 1; for (int j = 0; j < p.second; ++j) { v *= p.first; res.push_back(res[i] * v); } } } sort(all(res)); return res; } }; int main() { Eratosthenes er(250000); ll N,M;cin >>N >> M; vl A(M);rep(i,M)cin >> A[i]; vl Last(N+1,0); fore(a,A)Last[a]=1; vl L(N+1,0); ll Ans = 0; rrep(n,N){ if(n==0)continue; if(Last[n]==L[n]){ Ans+=1; } else{ auto div = er.divisors(n); fore(d,div){ L[d]+=1; L[d]%=2; } } } cout << Ans << endl; } #else #include #include using namespace std; using namespace atcoder; #define rep(i, n) for(int i = 0; i < n; i++) #define rrep(i, n) for(int i = n; i >= 0; i--) #define range(i, m, n) for(int i = m; i < n; i++) #define fore(i,a) for(auto &i:a) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define sum(v) accumulate(all(v),0) #define minv(v) *min_element(all(v)) #define maxv(v) *max_element(all(v)) typedef long long ll; typedef vector vl; typedef vector> vvl; const ll INF = 1e16; const ll MOD1 = 1000000007; const ll MOD2 = 998244353; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } ll SN(char s){return ll(s-'0');} ll SN(string s){return stoll(s);} int alpN(char s){return int(s-'a');} int AlpN(char s){return int(s-'a');} using Graph = vector>; using mint1 = modint1000000007; using mint2 = modint998244353; template ostream &operator<<(ostream &o,const vector&v){for(int i=0;i<(int)v.size();i++)o<<(i>0?" ":"")< bool contain(const std::string& s, const T& v) { return s.find(v) != std::string::npos; } #endif