#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m;
    cin >> n >> m;

    int r = 0;
    char a[51];
    for (int i = 0; i < n; i++) {
        cin >> a;
        for (int j = 0; j < m; j++) {
            if (a[j] != 'R') r++;
        }
    }

    cout << r << endl;

    return 0;
}