Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a[1005],n,x,k=0;
  8. cin >> n;
  9. for(int i=1;i<=n;i++){
  10. cin >> x;
  11. if(x==1){
  12. k++;
  13. }
  14. if(x%2==0){
  15. while(x%2==0){
  16. x=x/2;
  17. if(x==1){
  18. k++;
  19. }
  20. }
  21.  
  22. }
  23.  
  24. }
  25.  
  26. cout <<k;
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement