#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d%*c", &n);
  int pos = -1, ans = 0, flag = 0;
  for (int i = 0; i < n; i++) {
    char ch;
    scanf("%c", &ch);
    if (ch == 'L' && pos == -1) ans -= i;
    if (ch == 'L' && pos != -1) ans += (i - pos + 1) % 2, pos = -1;
    if (ch == 'R') pos = i;
    if (ch == '.' && pos == -1) ans++;
  }
  printf("%d", ans);
  return 0;
}
