#include <bits/stdc++.h>
using namespace std;
int N;
string str;
int res = 0;
int main() {
  int i = 0;
  char left = 'R';
  int l = -1;
  bool flag = false;
  scanf("%d", &N);
  cin >> str;
  for (i = 0; i < N; i++) {
    if (str[i] != '.') {
      if (str[i] == left)
        res += i - l - 1;
      else if (str[i] == 'L') {
        if (l == -1)
          ;
        else if ((i - l) % 2 == 0)
          res++;
      } else if (str[i] == 'R')
        res += i - l - 1;
      left = str[i];
      l = i;
    }
  }
  if (left == 'L') res += i - 1 - l;
  if (l == -1) res += N;
  cout << res << endl;
  return 0;
}
