41 lines
492 B
C++
41 lines
492 B
C++
#include <bits/stdc++.h>
|
|
#define endl '\n'
|
|
using namespace std;
|
|
|
|
int n, num, cnt = 0, sum = 0;
|
|
string str = "01";
|
|
|
|
int main() {
|
|
cin >> n;
|
|
|
|
for(int i = 1; i <= n; i++) {
|
|
cin >> num;
|
|
int t = num;
|
|
|
|
string out = "";
|
|
int cnt1 = 0;// 判断1的个数
|
|
|
|
while(t > 0) {
|
|
int g = t % 2;
|
|
|
|
if(g == 1){
|
|
sum++; // 总数加一
|
|
cnt1++; // 个数加一
|
|
}
|
|
|
|
out = str[g] + out;
|
|
t /= 2;
|
|
}
|
|
|
|
if(cnt1 == 1){
|
|
cnt++;
|
|
}
|
|
}
|
|
|
|
cout << cnt << endl << sum;
|
|
|
|
|
|
return 0;
|
|
}
|
|
|