#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  int last = -1;
  char lop = '0';
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (str[i] == 'L') {
      if (lop == 'R') {
        if ((i - last) % 2 == 0) {
          ans++;
        }
      }
      last = i;
      lop = str[i];
    } else if (str[i] == 'R') {
      ans += i - last - 1;
      last = i;
      lop = str[i];
    }
  }
  if (lop != 'R') ans += n - last - 1;
  cout << ans << endl;
}
