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.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

/**
 * Created with IntelliJ IDEA.
 * User: AUtemuratov
 * Date: 07.04.14
 * Time: 15:43
 * To change this template use File | Settings | File Templates.
 */
public class Main {
    static int p[] = new int[1111111];
    static int q[] = new int[1111111];
    //static int A[][] = new int[1111][1111];
    //static boolean u[] = new boolean[1111];
    //static boolean U[][] = new boolean[1111][1111];

    //static ArrayList<Integer> list = new ArrayList<Integer>();
    //static Stack<Integer> stack = new Stack<Integer>();
    //static HashSet<Integer> set = new HashSet<Integer>();

    static FastReader fr = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter pw = new PrintWriter(System.out);
    static int max = Integer.MIN_VALUE;
    static int min = Integer.MAX_VALUE;
    static int sum,cnt,n;
    static char c[] = new char[1111];
    static String s;
    public static void main(String[] args) throws Exception {
        int Q = 0;
        n = fr.nextInt();
        s = "L" + fr.nextToken() + "R";
        for (int i=0; i<s.length(); i++) {
            if (s.charAt(i)=='.') {
                Pair l = new Pair(getLeft(i));
                Pair r = new Pair(getRight(i));

                if (l.b=='R' && r.b=='L' && (l.a+r.a)/2==i && (l.a+r.a)%2==0) {
                    cnt++;
                } else if (l.b=='L' && r.b=='R') {
                    cnt++;
                }

            }
        }
        pw.println(cnt);
        pw.close();
    }

    private static Pair getLeft(int pos) {
        char t = 0;
        int loc = 0;
        for (int i=pos-1; i>=0; i--) {
            if (s.charAt(i)!='.') {
               t = s.charAt(i);
               loc = i;
               break;
            }
        }
        return new Pair(loc,t);
    }

    private static Pair getRight(int pos) {
        char t = 0;
        int loc = 0;
        for (int i=pos+1; i<s.length(); i++) {
            if (s.charAt(i)!='.') {
                t = s.charAt(i);
                loc = i;
                break;
            }
        }
        return new Pair(loc,t);
    }
}

class Pair {
    int a;
    char b;
    public Pair(int a, char b) {
        this.a = a;
        this.b = b;
    }

    public Pair (Pair p) {
        this.a = p.a;
        this.b = p.b;
    }
}

class FastReader {

    BufferedReader bf;
    StringTokenizer tk = null;
    String DELIM = " ";

    public FastReader(BufferedReader bf) {
        this.bf = bf;
    }

    public String nextToken() throws Exception {

        if(tk==null || !tk.hasMoreTokens()) {
            tk = new StringTokenizer(bf.readLine(),DELIM);
        }
        return tk.nextToken();
    }

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public int nextLong() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public int nextDouble() throws Exception {
        return Integer.parseInt(nextToken());
    }
}
