Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show".

Chris arranges n dominoes in a line, placing each piece vertically upright. In the beginning, he simultaneously pushes some of the dominoes either to the left or to the right. However, somewhere between every two dominoes pushed in the same direction there is at least one domino pushed in the opposite direction.

After each second, each domino that is falling to the left pushes the adjacent domino on the left. Similarly, the dominoes falling to the right push their adjacent dominoes standing on the right. When a vertical domino has dominoes falling on it from both sides, it stays still due to the balance of the forces. The figure shows one possible example of the process.

<image>

Given the initial directions Chris has pushed the dominoes, find the number of the dominoes left standing vertically at the end of the process!

Input

The first line contains a single integer n (1 ≤ n ≤ 3000), the number of the dominoes in the line. The next line contains a character string s of length n. The i-th character of the string si is equal to 

  * "L", if the i-th domino has been pushed to the left; 
  * "R", if the i-th domino has been pushed to the right; 
  * ".", if the i-th domino has not been pushed. 



It is guaranteed that if si = sj = "L" and i < j, then there exists such k that i < k < j and sk = "R"; if si = sj = "R" and i < j, then there exists such k that i < k < j and sk = "L".

Output

Output a single integer, the number of the dominoes that remain vertical at the end of the process.

Examples

Input

14
.L.R...LR..L..


Output

4


Input

5
R....


Output

0


Input

1
.


Output

1

Note

The first example case is shown on the figure. The four pieces that remain standing vertically are highlighted with orange.

In the second example case, all pieces fall down since the first piece topples all the other pieces.

In the last example case, a single piece has not been pushed in either direction.
#include <bits/stdc++.h>
using namespace std;
char a[3005];
bool check[3005];
int n;
void readfile() {
  if (0) {
    freopen("input.txt", "r", stdin);
  };
  scanf("%d\n", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%c", &a[i]);
    if (a[i] != '.') check[i] = true;
  }
}
void solve() {
  for (int sec = 1; sec <= n; ++sec) {
    bool f = false;
    for (int i = 2; i < n; ++i) {
      if (a[i] != '.') continue;
      if (check[i - 1] && check[i + 1] && a[i - 1] == 'R' && a[i + 1] == 'L')
        continue;
      if (a[i + 1] == 'L' && check[i + 1]) a[i] = 'L';
      if (a[i - 1] == 'R' && check[i - 1]) a[i] = 'R';
      if (a[i] != '.') f = true;
    }
    if (f == false) break;
    for (int i = 1; i <= n; ++i)
      if (a[i] != '.') check[i] = true;
  }
  if (a[2] == 'L') a[1] = 'L';
  if (a[n - 1] == 'R') a[n] = 'R';
  int res = 0;
  for (int i = 1; i <= n; ++i) res += (a[i] == '.');
  printf("%d\n", res);
}
int main() {
  readfile();
  if (n == 1 && a[1] == '.') {
    printf("1\n");
    return 0;
  }
  solve();
}
