#include <bits/stdc++.h>
char local = 'O';
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int key = 1, ii = -1;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (s[i] == 'L' || s[i] == 'R') {
      ii = i;
      if (s[i] == 'R') key = 0;
      break;
    }
  }
  int j;
  if (key == 0) {
    ans += ii;
    j = ii;
  } else
    j = ii + 1;
  int st = 0, l = -1;
  if (local == 'L') {
    cout << "ans"
         << " " << ans << "\n";
  };
  for (long long i = j; i < n; i++) {
    if (local == 'L') {
      cout << "i"
           << " " << i << " "
           << "st"
           << " " << st << " "
           << "s[i]"
           << " " << s[i] << "\n";
    };
    if (local == 'L') {
      cout << "i"
           << " " << i << " "
           << "ans"
           << " " << ans << "\n";
    };
    if (st == 0 && s[i] == '.')
      ans++;
    else if (st == 0 && s[i] == 'R') {
      l = i;
      st = 1;
    } else if (st == 1 && s[i] == 'L') {
      if ((i - l) % 2 == 0) ans++;
      l = -1;
      st = 0;
    }
    if (local == 'L') {
      cout << "i"
           << " " << i << " "
           << "ans"
           << " " << ans << " "
           << "st"
           << " " << st << "\n";
    };
  }
  cout << ans << "\n";
  return 0;
}
