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;
- void fac(int n, set<ll>s) {
- for (int i=2; i<=n; i++) {
- if (n%i==0) {
- c.insert(i);
- s.insert(i);
- while (n>0 && n%i==0) {
- n/=i;
- }
- }
- }
- if (s.empty()) c.insert(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,c);
- }
- // for (auto i:c) cout << i << " ";
- cout << c.size();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment