Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- using namespace std;
- set<ll>c;
- map<int,int>m;
- vector<int>v;
- void fac(int n) {
- int f=0;
- for (int i=2; i<=n; i++) {
- if (n%i==0) {
- f++;
- if (!m[i]) {
- m[i]++;
- v.push_back(i);
- }
- // c.insert(i);
- // s.insert(i);
- while (n>0 && n%i==0) {
- n/=i;
- }
- }
- }
- if (!f) v.push_back(n);
- }
- int main() {
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- int n;
- cin >> n;
- while (n--) {
- int x;
- cin >> x;
- fac(x);
- }
- // for (auto i:c) cout << i << " ";
- cout << v.size();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment