#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
int n, m;
cin >> n >> m;
set<int> ans;
vector<string> v(n);
for (auto &i : v) cin >> i;
for (int j = 0; j < m; ++j) {
vector<int> temp;
for (int i = 0; i < n; ++i) {
if (v[i][j] == '1') temp.push_back(i);
}
if (temp.size() == 1) ans.insert(temp.back());
}
cout << ans.size() << '\n';
return 0;
}
Copy