#include <bits/stdc++.h>
using namespace std;
enum class DominoState { FallingLeft, FallingRight, Stands, Fallen, UnKnown };
DominoState State(char c) {
  switch (c) {
    case '.':
      return DominoState::Stands;
    case 'L':
      return DominoState::FallingLeft;
    case 'R':
      return DominoState::FallingRight;
    default:
      return DominoState::UnKnown;
  }
}
class DominoGame {
 public:
  DominoGame(istream& is) : result(0) {
    int n;
    is >> n;
    string s;
    is >> s;
    auto r_pos = s.find('R');
    for (auto pos = r_pos == s.npos ? s.length() - 1 : r_pos - 1; pos >= 0;
         --pos) {
      DominoState state = State(s[pos]);
      switch (state) {
        case DominoState::Stands:
          result++;
          continue;
        default:
        case DominoState::FallingLeft:;
      }
      break;
    }
    if (r_pos == s.npos) return;
    auto l_pos = s.find('L', r_pos + 1);
    while (l_pos != s.npos && r_pos != s.npos) {
      if ((l_pos - r_pos) % 2 == 0) result++;
      r_pos = s.find('R', l_pos + 1);
      if (r_pos == s.npos) {
        result += s.length() - l_pos - 1;
        return;
      }
      result += r_pos - l_pos - 1;
      l_pos = s.find('L', r_pos + 1);
    }
  }
  int GetResult() { return result; }

 private:
  int result;
};
int main() {
  DominoGame game(cin);
  cout << game.GetResult();
  return 0;
}
