#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum = 0;
  cin >> n;
  bool isLR = false;
  char a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 'L' || a[i] == 'R') isLR = true;
  }
  bool flag = false;
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == '.' && flag == true)
      count++;
    else if (a[i] == 'L')
      flag = true;
    else if (a[i] == 'R') {
      sum += count;
      count = 0;
      flag = false;
    }
  }
  flag = false;
  count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == '.' && flag == true)
      count++;
    else if (a[i] == 'R')
      flag = true;
    else if (a[i] == 'L') {
      if (count % 2 != 0) sum++;
      count = 0;
      flag = false;
    }
  }
  count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == '.')
      count++;
    else if (a[i] == 'L')
      break;
    else if (a[i] == 'R') {
      sum += count;
      break;
    }
  }
  count = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] == '.')
      count++;
    else if (a[i] == 'R')
      break;
    else if (a[i] == 'L') {
      sum += count;
      break;
    }
  }
  if (isLR == true)
    cout << sum;
  else
    cout << n;
  return 0;
}
