#include <bits/stdc++.h>
using namespace std;
string input;
void L(int i, int& result) {
  int counter = 0;
  for (int j = i + 1; j < input.size(); j++) {
    counter = 0;
    if (input[j] == 'R')
      while (j < input.size() && input[j] != 'L') {
        j++, counter++;
        if (counter % 2 && j + 1 < input.size() && input[j + 1] == 'L')
          result++;
      }
    else
      result++;
  }
}
int main() {
  ios::sync_with_stdio(false);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  int result, counter;
  cin >> result;
  cin >> input;
  for (int i = 0; i < input.size(); i++)
    if (input[i] == 'L') {
      result = 0;
      L(i, result);
      break;
    } else if (input[i] == 'R') {
      counter = 0;
      result = i;
      for (int j = i + 1; j < input.size();)
        if (input[j] != 'L')
          while (j < input.size() && input[j] != 'L') {
            counter++;
            if (counter % 2 && j + 1 < input.size() && input[j + 1] == 'L')
              result++;
            j++;
          }
        else {
          L(j, result);
          break;
        }
      break;
    }
  cout << result << endl;
  return 0;
}
