#include <bits/stdc++.h>
using namespace std;
char ss[1010000];
int n;
void solve(void) {
  scanf("%s", ss);
  int ans = 0;
  bool ok = false;
  int last = 0;
  int op = 0, ed = n - 1;
  for (int i = 0; i < (n); i++) {
    if (ss[i] == '.') continue;
    if (ss[i] == 'L') op = i + 1;
    break;
  }
  for (int i = (n - 1); i >= (0); i--) {
    if (ss[i] == '.') continue;
    if (ss[i] == 'R') ed = i - 1;
    break;
  }
  for (int i = (op); i <= (ed); i++) {
    if (ss[i] == 'R') {
      ok = true;
      last = i;
    } else if (ss[i] == 'L') {
      ok = false;
      if ((i - last) % 2 == 0) ans++;
    } else if (!ok)
      ans++;
  }
  printf("%d\n", ans);
}
int main(void) {
  while (EOF != scanf("%d", &n)) solve();
  return 0;
}
