#include using namespace std; template using umap = unordered_map; using ll = long long; using ld = long double; using pii = pair; using pll = pair; using vi = vector; using vll = vector; using vs = vector; using mapii = map; using umapii = umap; #define _rep(i, n) _repi(i, 0, n) #define _repi(i, a, b) for(ll i = (ll) (a); i < (ll) (b); i++) #define _get_rep(_1, _2, _3, NAME, ...) NAME #define rep(...) _get_rep(__VA_ARGS__, _repi, _rep) (__VA_ARGS__) #define all(x) x.begin(), x.end() #define chmax(x, y) (x) = max((x), (y)) #define chmin(x, y) (x) = min((x), (y)) #define mkpair make_pair #define print(...) osout(cout, __VA_ARGS__) #define dbg(...) osout(cerr, __VA_ARGS__) #define INF INT_MAX / 2 #define LINF LLONG_MAX / 2 template istream& operator >>(istream& is, vector& v) { rep(i, v.size()) { cin >> v[i]; } return is; } template ostream& operator <<(ostream& os, pair p) { os << p.first << ", " << p.second; return os; } template ostream& operator <<(ostream& os, vector v) { if(v.size()==0){ return os; } rep(i, v.size()-1) { os << (v[i]) << ' '; } os << v[v.size()-1]; return os; } void osout(ostream& os) { os << endl; } template void osout(ostream& os, S s, T... t) { os << (s); if (sizeof...(t)) os << ' '; osout(os, t...); } void solve(); int main() { cin.tie(0); ios::sync_with_stdio(false); // cout << fixed << setprecision(15); solve(); return 0; } void solve() { int n, m; cin >> n >> m; vs a(n); cin >> a; int ans = 0; rep (i, n) rep (j, m) ans += a[i][j] != 'R'; print(ans); }