#include <bits/stdc++.h>
using namespace std;
long long nCr(long long n, long long r) {
  vector<vector<long long> > ans(n + 1);
  ans[0].push_back(1);
  ans[1].push_back(1);
  ans[1].push_back(1);
  for (int i = 2; i <= n; i++) {
    ans[i].push_back(1);
    for (int j = 1; j < ans[i - 1].size(); j++) {
      ans[i].push_back(ans[i - 1][j - 1] + ans[i - 1][j]);
    }
    ans[i].push_back(1);
  }
  return ans[n][r];
}
long long lowe(vector<long long> v, long long m) {
  long long l = 1;
  long long r = v.size();
  long long ans = 0;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (v[mid - 1] > m) {
      r = mid - 1;
    } else {
      ans = mid;
      l = mid + 1;
    }
  }
  return ans;
}
bool isprime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
long long nmod(long long h, long long m) {
  while (h < 0) {
    h += m;
  }
  return h % m;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  long long n;
  cin >> n;
  string second;
  cin >> second;
  long long o = 0;
  long long ans = 0;
  while (1) {
    if (second[o] != '.') {
      if (second[o] == 'R') {
        ans += o;
      }
      break;
    }
    o++;
  }
  long long p = n - 1;
  while (1) {
    if (second[p] != '.') {
      if (second[p] == 'L') {
        ans += n - 1 - p;
      }
      break;
    }
    p--;
  }
  char prev = '#';
  long long pre;
  long long c = 0;
  for (int i = o; i <= p; i++) {
    if (second[i] != '.') {
      c = 1;
      if (prev != '#') {
        if (prev == 'L' && second[i] == 'R') ans += i - pre - 1;
        if (prev == 'R' && second[i] == 'L') ans += (i - pre - 1) % 2;
        prev = second[i];
        pre = i;
      } else {
        prev = second[i];
        pre = i;
      }
    }
  }
  if (c == 0) {
    cout << second.size();
    return 0;
  }
  cout << ans;
  return 0;
}
