#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
vector<string> vec;
for (int i = 0; i < n; i++) {
string g;
cin >> g;
vec.push_back(g);
}
vector<bool> sol(n, false);
for (int i = 0; i < m; i++) {//index
int counter = 0, ind = -1;
for (int j = 0; j < n; j++) {//string
//if(vec[j][i] != vec[j+1][i])
if (vec[j][i] == '1') {
counter++;
ind = j;
}
}
if (counter == 1) {
sol[ind] = true;
}
counter = 0;
}
//return 0;
int ans = 0;
for (auto i : sol) {
if (i)
ans++;
}
cout << ans << endl;
return 0;
}
Copy