#include #include using namespace std; using namespace atcoder; using ll = long long; int N, M, cnt[1010], m = 1e9; string S; int main() { cin >> N >> M; for (int i = 0; i < N; i++) { cin >> S; for (int j = 0; j < M; j++) { if (S[j] == 'o') cnt[j]++; } } for (int i = 0; i < M; i++) { m = min(m, cnt[i]); } cout << N - m + 1 << endl; return 0; }