#include <bits/stdc++.h>
using namespace std;
int a, fi, la, ans, c, d;
string b;
int main() {
  cin >> a >> b;
  ans = a;
  for (int i = 0; i < a; i++) {
    if (b[i] == 'L') {
      ans -= i;
      ans -= 1;
      fi = i + 1;
      break;
    }
    if (b[i] == 'R') {
      fi = i;
      break;
    }
  }
  for (int i = a - 1; i >= 0; i--) {
    if (b[i] == 'L') {
      la = i;
      break;
    }
    if (b[i] == 'R') {
      ans += i;
      ans -= a;
      la = i - 1;
      break;
    }
  }
  for (int i = fi; i <= la; i++) {
    if (b[i] != '.') break;
    if (i == la) {
      cout << ans << endl;
      return 0;
    }
  }
  for (int i = fi; i <= la;) {
    while (b[i] == '.' && i <= la) i++;
    c = i;
    i++;
    while (b[i] == '.' && i <= la) i++;
    d = i;
    if (i <= la) {
      ans -= d;
      ans += c;
      ans -= 1;
      if ((d - c - 1) % 2 == 1) ans++;
    }
    i++;
  }
  cout << ans << endl;
  return 0;
}
