#include <bits/stdc++.h>
using namespace std;
void read(string& s) {
  char buf[650000];
  scanf("%s", buf);
  s = buf;
}
long long int to_lli(string s) {
  long long int a;
  istringstream(s) >> a;
  return a;
}
string to_String(long long int a) {
  ostringstream os;
  os << a;
  return os.str();
}
long long int gcd(long long int a, long long int b) {
  long long int c;
  while (a != 0) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}
struct CompareByValue {
  bool operator()(const pair<char, long long int>& a,
                  const pair<char, long long int>& b) const {
    if (a.second < b.second) return true;
    if (a.second > b.second) return false;
    if (a.first < b.first)
      return true;
    else
      return false;
  };
};
int a[3005];
int main() {
  int n, i, j, ans = 0;
  string s;
  cin >> n;
  cin >> s;
  char start, end;
  int st = 0, ed;
  start = s[0];
  if (n == 1 && s[0] == '.') {
    cout << "1";
    return 0;
  }
  for (i = 1; i < n; i++) {
    if (s[i] == '.' && i != n - 1)
      continue;
    else {
      end = s[i];
      ed = i;
      if (start == '.' && end == 'L') {
        ans += 0;
        start = 'L';
        st = i;
      } else if (start == '.' && end == 'R') {
        ans += ed - st;
        start = 'R';
        st = i;
      } else if (start == 'R' && end == 'L') {
        int num = ed - st + 1;
        if (num % 2 != 0) ans += 1;
        start = 'L';
        st = i;
      } else if (start == 'L' && end == 'R') {
        ans += ed - st - 1;
        start = 'R';
        st = i;
      } else if (start == 'L' && end == '.') {
        ans += ed - st;
      } else if (start == '.' && end == '.')
        ans += ed - st + 1;
    }
  }
  cout << ans;
  return 0;
}
