#include <bits/stdc++.h>
using namespace std;
int n;
string a;
int main() {
  cin >> n >> a;
  int len = a.size();
  bool first = true;
  int ans = 0, x = -1;
  char before = 'L';
  for (int i = 0; i < len; i++) {
    if (a[i] != '.' && first) {
      if (a[i] == 'R')
        ans += i;
      else
        ans = 0;
      x = i;
      first = false;
      before = a[i];
      continue;
    }
    if (a[i] != '.') {
      if (a[i] == 'R')
        ans += i - x - 1;
      else if ((i - x) % 2 == 0)
        ans++;
      x = i;
      before = a[i];
      continue;
    }
    if (i == len - 1) {
      if (before == 'L') ans += i - x;
    }
  }
  cout << ans << endl;
  return 0;
}
