#include <bits/stdc++.h>
using namespace std;
int a[3010][2];
bool imp(bool* st, int n, int stat) {
  bool b = 0;
  int inv;
  if (stat)
    inv = 0;
  else
    inv = 1;
  for (int i = 1; i <= n; i++) {
    if (a[i][stat] == -1) {
      b = 1;
      a[i][stat] = 0;
      st[i] = 0;
      if (st[i - 1]) a[i - 1][inv]--;
    } else if (a[i][stat] == 1) {
      b = 1;
      a[i][stat] = 0;
      st[i] = 0;
      if (st[i + 1]) a[i + 1][inv]++;
    }
  }
  return b;
}
int main() {
  char p;
  int n;
  bool st[3010], l;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> p;
    if (p == '.') {
      a[i][0] = 0;
      st[i] = 1;
    } else {
      st[i] = 0;
      if (p == 'L')
        a[i][0] = -1;
      else
        a[i][0] = 1;
    }
  }
  int j = 0;
  do {
    l = imp(st, n, j % 2);
    j++;
  } while (l);
  j = 0;
  for (int i = 1; i <= n; i++)
    if (st[i]) j++;
  cout << j;
  return 0;
}
