#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int maxn = 100005;
int main() {
  int n;
  cin >> n;
  char c;
  int ans = 0;
  int cnt = 0;
  int l = 0, r = 0;
  for (int i = 1; i <= n; i++) {
    cin >> c;
    if (c == '.') {
      if (!r) cnt++;
    } else if (c == 'L') {
      cnt = 0;
      l = i;
      if (r) {
        if ((l - r) % 2 == 0) ans++;
        l = r = 0;
      }
    } else {
      ans += cnt;
      cnt = 0;
      r = i;
    }
  }
  ans += cnt;
  cout << ans << endl;
  return 0;
}
