#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, st = -1, end = -1, f = 0, z = 0, ans = 0, ind;
  cin >> n;
  string s;
  char last, first;
  cin >> s;
  int p = s.find('L');
  int q = s.find('R');
  if (p == -1 && q == -1) {
    cout << s.length() << endl;
  } else {
    for (int i = 0; i < s.length(); i++) {
      if (s[i] != '.') {
        first = s[i];
        break;
      }
    }
    for (int i = 0; i < s.length(); i++) {
      if (s[i] != '.') {
        last = s[i];
        ind = i;
      }
      if (s[i] == 'L') {
        if (z) {
          if ((i - st - 1) % 2 != 0) {
            ans++;
          }
        }
        st = i;
        f = 1;
      }
      if (s[i] == 'R') {
        if (f) {
          ans += (i - st - 1);
          f = 0;
        }
        st = i;
        z = 1;
      }
    }
    if (last == 'L') {
      for (int i = ind + 1; i < s.length(); i++) {
        ans++;
      }
    }
    if (first == 'R') {
      for (int i = 0; i < s.length(); i++) {
        if (s[i] == 'R') {
          break;
        } else
          ans++;
      }
    }
    cout << ans << endl;
  }
}
