Vova has won n trophies in different competitions. Each trophy is either golden or silver. The trophies are arranged in a row.

The beauty of the arrangement is the length of the longest subsegment consisting of golden trophies. Vova wants to swap two trophies (not necessarily adjacent ones) to make the arrangement as beautiful as possible — that means, to maximize the length of the longest such subsegment.

Help Vova! Tell him the maximum possible beauty of the arrangement if he is allowed to do at most one swap.

Input

The first line contains one integer n (2 ≤ n ≤ 10^5) — the number of trophies.

The second line contains n characters, each of them is either G or S. If the i-th character is G, then the i-th trophy is a golden one, otherwise it's a silver trophy. 

Output

Print the maximum possible length of a subsegment of golden trophies, if Vova is allowed to do at most one swap.

Examples

Input


10
GGGSGGGSGG


Output


7


Input


4
GGGG


Output


4


Input


3
SSS


Output


0

Note

In the first example Vova has to swap trophies with indices 4 and 10. Thus he will obtain the sequence "GGGGGGGSGS", the length of the longest subsegment of golden trophies is 7. 

In the second example Vova can make no swaps at all. The length of the longest subsegment of golden trophies in the sequence is 4. 

In the third example Vova cannot do anything to make the length of the longest subsegment of golden trophies in the sequence greater than 0.
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * @author khokharnikunj8
 */

public class Main {
    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                new Main().solve();
            }
        }, "1", 1 << 26).start();
    }

    void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BVovaAndTrophies solver = new BVovaAndTrophies();
        solver.solve(1, in, out);
        out.close();
    }

    static class BVovaAndTrophies {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            char[] ar = in.scanString().toCharArray();
            int[] pre_f = new int[n];
            int[] pre_b = new int[n];
            for (int i = 0; i < n; i++) {
                if (ar[i] == 'G') {
                    if (i == 0) pre_f[i] = 1;
                    else pre_f[i] = pre_f[i - 1] + 1;
                }
            }
            for (int i = n - 1; i >= 0; i--) {
                if (ar[i] == 'G') {
                    if (i == n - 1) pre_b[i] = 1;
                    else pre_b[i] = pre_b[i + 1] + 1;
                }
            }
            int total = 0;
            for (int i = 0; i < n; i++) if (ar[i] == 'G') total++;
            int ans = 0;
            for (int i = 0; i < n; i++) ans = Math.max(ans, pre_f[i]);
            for (int i = 0; i < n; i++) {
                if (ar[i] == 'S') {
                    int left = 0;
                    int right = 0;
                    if (i != 0) left = pre_f[i - 1];
                    if (i != n - 1) right = pre_b[i + 1];
                    if (left + right == total) ans = Math.max(left + right, ans);
                    else ans = Math.max(ans, left + right + 1);

                }

            }
            out.println(ans);
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        public String scanString() {
            int c = scan();
            if (c == -1) return null;
            while (isWhiteSpace(c)) c = scan();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = scan();
            } while (!isWhiteSpace(c));
            return res.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}

