#include <bits/stdc++.h>
using namespace std;
int n, tmp, ans;
char c, s[3005];
int main() {
  cin >> n >> s;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '.') {
      tmp++;
    } else if (s[i] == 'L') {
      ans += tmp;
      tmp = 0;
      c = s[i];
    } else {
      if (c == 'L') ans += tmp % 2;
      c = s[i];
      tmp = 0;
    }
  }
  if (c != 'L') ans += tmp;
  cout << ans;
  return 0;
}
