#include <bits/stdc++.h>
using namespace std;
const long long INF = 2ll * 1000 * 1000 * 1000 * 1000;
const int MAXN = 100 * 100 * 100 + 101;
const int lim = 1000 * 100 * 100 + 1;
int n, l, r, ans, v;
bool used[MAXN];
char ch;
int main() {
  cin >> n;
  l = 1;
  for (int i = 1; i <= n; i++) {
    cin >> ch;
    if (ch == 'L') {
      for (int j = l; j <= i; j++) used[j] = true;
      if ((i - l + 1) % 2 == 1 && v) ans++;
    } else if (ch == 'R') {
      v++;
      l = i;
    }
  }
  if (!used[l] && v)
    for (int i = l; i <= n; i++) used[i] = true;
  for (int i = 1; i <= n; i++)
    if (!used[i]) ans++;
  cout << ans;
  return 0;
}
