#include <bits/stdc++.h>
using namespace std;
void solve()
{
int n, m;
int id[n] = { 0 };
cin >> n >> m;
char a[n][m];
for (int r = 0; r < n; r++)
{
for (int c = 0; c < m; c++)
{
scanf(" %c", &a[r][c]);
}
}
int index;
for (int c = 0; c < m; c++)
{
int cnt = 0;
for (int r = 0; r < n; r++)
{
if (a[r][c] == '1')
{
cnt++;
index = r;
}
}
if (cnt == 1)
{
id[index] = 1;
}
}
int ct = 0;
for (int i = 0; i < n; i++)
{
if (id[i] == 1) ct++;
}
printf("%d", ct);
}
int main() {
int t = 1;
//cin>>t;
while (t--)
{
solve();
cout << endl;
}
return 0;
}
Copy