#include <bits/stdc++.h>
using namespace std;
char a[3001];
int n, res, pl, pr;
int main() {
  scanf("%i\n", &n);
  for (int i = 1; i <= n; ++i) scanf("%c", &a[i]);
  for (int i = 1; i <= n; ++i)
    if (a[i] != '.') {
      if (a[i] == 'L') {
        if (pr != 0)
          if (((i - pr + 1) % 2) != 0) ++res;
        pl = i;
      } else {
        if ((pl == 0) and (pr == 0)) res += i - 1;
        if (pl != 0) res += i - pl - 1;
        pr = i;
      }
    }
  if ((pl > pr) and (pl < n)) res += n - pl;
  if ((pl == 0) and (pr == 0)) res += n;
  printf("%i", res);
}
