fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n,contor=0;
  6. cin>>n;
  7. while(n){
  8. int a=n;
  9. cin>>n;
  10. int b=n;
  11. while(b!=0){
  12. int r=a%b;
  13. a=b;
  14. b=r;}
  15. if(a==1){
  16. contor++;
  17. }
  18. }
  19. cout<<contor;
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0.01s 5296KB
stdin
4 9 25 16 7 21 0
stdout
4