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.*;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;
 
public class solver implements Runnable {
        final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
        BufferedReader in;
        PrintWriter out;
        StringTokenizer tok = new StringTokenizer("");
       
        void init() throws FileNotFoundException{
            if (ONLINE_JUDGE){
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
           }else{
                in = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
           }
        }       
        String readString() throws IOException{
                while(!tok.hasMoreTokens()){
                        try{
                                tok = new StringTokenizer(in.readLine());
                        }catch (Exception e){
                                return null;
                        }
                }
                return tok.nextToken();
        }
        String readString(String delim) throws IOException{
            while(!tok.hasMoreTokens()){
                    try{
                            tok = new StringTokenizer(in.readLine());
                    }catch (Exception e){
                            return null;
                    }
            }
            return tok.nextToken(delim);
    }
       
        int readInt() throws IOException{
                return Integer.parseInt(readString());
        } 
        int readInt(String delim) throws IOException{
            return Integer.parseInt(readString(delim));
        } 
        long readLong() throws IOException{
                return Long.parseLong(readString());
        }  
        long readLong(String delim) throws IOException{
            return Long.parseLong(readString(delim));
        }      
        double readDouble() throws IOException{
                return Double.parseDouble(readString());
        }      
        double readDouble(String delim) throws IOException{
            return Double.parseDouble(readString(delim));
        } 
        char readChar() throws IOException {
            char val = 0;
            do{
                val = (char) in.read();
            }while(val == '\n' || val == '\r');
            return val;
        }
        char readChar(String skipChars)throws IOException{
            char val = 0;
            boolean ret;
            do{
                val = (char) in.read();
                ret = false;
                for (int i = skipChars.length()-1; i >= 0; i--){
                    if (skipChars.charAt(i) == val){
                        ret = true;
                        break;
                    }
                }
            }while(ret);
            return val;
        }
        
        public class Pair<T1,T2> {
            public T1 x1;
            public T2 x2;
            public Pair(){};
            public Pair(T1 x1, T2 x2){
                this.x1 = x1;
                this.x2 = x2;
            }
        }
        public class Point implements Comparable<Point>{
            public int x1, x2;
            public Point(){}
            public Point(int a, int b){x1 = a;x2=b;}
            public int compareTo(Point o) {
                return x1-o.x1;
            }
        }
 //----------------------------------------
        
         public void solve() throws IOException {
             int n = readInt();
             char[] arr = new char[n];
             for (int i = 0; i < n; i++){
                 arr[i] = readChar();
             }
             
             int rr = -1;
             int res = 0;
             
             for (int i = 0; i < n; i++){
                 if (arr[i] == 'R'){
                     res+=i;
                     break;
                 }
                 if (arr[i] == 'L'){
                     break;
                 }
             }
             
             for (int i = n-1; i >= 0; i--){
                 if (arr[i] == 'L'){
                     res+=n-i-1;
                     break;
                 }
                 if (arr[i] == 'R'){
                     break;
                 }
             }
             
             for (int i = 0; i < n; i++){
                 if (arr[i] == 'R'){
                     rr = i;
                 }
                 if (arr[i] == 'L' && rr != -1){
                     if ((i - rr)%2 == 0){
                         res++;
                     }
                     rr = -1;
                 }
             }
             int ll = -1;
             
             for (int i = 0; i < n; i++){
                 if (arr[i] == 'L'){
                     ll = i;
                 }
                 if (arr[i] == 'R' && ll != -1){
                     res += i - ll-1;
                     ll = -1;
                 }
             }
             
             boolean ff = true;
             for (int i = 0; i < n; i++){
                 if (arr[i] == 'L' || arr[i] == 'R'){
                     ff = false;
                 }
             }
             if (ff){
                 out.print(n);
             }else
                         {
                 out.print(res);
             }
         }
         
//----------------------------------------
        public static void main(String[] args){
                new Thread(null, new solver(), "", 256 * (1L << 20)).start();
        }
       
        long timeBegin, timeEnd;
 
        void time(){
                timeEnd = System.currentTimeMillis();
                System.err.println("Time = " + (timeEnd - timeBegin));
        }
       
        public void run(){
                try{
                        timeBegin = System.currentTimeMillis();
                        init();
                        solve();
                        out.close();
                        time();
                }catch (Exception e){
                        e.printStackTrace(System.err);
                        System.exit(-1);
                }
        }
}