#include <bits/stdc++.h>
using namespace std;
long long LLMAX = 9223372036854775807LL;
const int MOD = 1000000007;
const int maxn = 1000000 + 10;
int n;
char a[maxn];
int main() {
  scanf("%d\n", &n);
  scanf("%s", a);
  int fr, ls;
  for (fr = 0; fr < n; ++fr)
    if (a[fr] != '.') break;
  if (fr == n) {
    printf("%d\n", (n));
    return 0;
  }
  for (ls = n - 1; ls > fr; --ls)
    if (a[ls] != '.') break;
  int ans = 0, last = -1, f = 0;
  if (a[fr] != 'L') {
    last = fr;
    f = 1;
    ans += fr;
  } else
    ;
  if (a[ls] == 'L') ans += (n - ls - 1);
  for (int i = fr + 1; i <= ls; ++i) {
    if (f == 0 && a[i] == '.')
      ans++;
    else if (a[i] != '.') {
      if (f == 0) {
        last = i;
        f = 1;
      } else {
        if ((i - last + 1) % 2 == 1 && (i - last + 1) > 0) ans++;
        last = i;
        f = 0;
      }
    }
  }
  printf("%d\n", (ans));
}
