// Arup Guha
// 6/8/2026
// Solution to Kattis Problem: Epig Dance Off
// https://open.kattis.com/problems/epigdanceoff

using namespace std;
#include <bits/stdc++.h>

int numDancePoses(vector<vector<char>>& grid);

int main() {

    int r, c;
    cin >> r >> c;

    // Read in the grid.
    vector<vector<char>> grid(r);
    for (int i=0; i<r; i++) {
        string s;
        cin >> s;
        for (int j=0; j<c; j++)
            grid[i].push_back(s[j]);
    }

    // Number of dance poses.
    cout << numDancePoses(grid)<< endl;

    return 0;
}

// Returns the number of dance poses, which equals the number of columns in
// grid filled with the '_' character only, plus 1.
int numDancePoses(vector<vector<char>>& grid) {

    // # of poses is one more than number of dividers.
    int res = 1;

    // j is my column number.
    for (int j=0; j<grid[0].size(); j++) {

        // We assume it's all underscores.
        int ok = 1;

        // Stop if we find a non underscore.
        for (int i=0; i<grid.size(); i++) {
            if (grid[i][j] != '_') {
                ok = 0;
                break;
            }
        }

        // Update as needed.
        res += ok;
    }

    // Ta da!
    return res;
}
