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 static java.lang.System.out;
import java.io.*; 
import java.util.*; 
public class Main{
	static PrintWriter pp = new PrintWriter((System.out));
	public static void main(String[] args) throws IOException {
		in sc = new in();  
		int t = 1; //sc.iin(); 
		// for single output use out
		while(t-- > 0){
		    int n = sc.iin(); 
			char c[] = sc.scin();
			int countg = 0; 
			ArrayList<Integer> a = new ArrayList<>(); 
			for(int i = 0; i < c.length; i++){
			    if(c[i] == 'S')
			    a.add(i); 
			    else{
			        countg++; 
			    }
			}
			if(a.size() == c.length)         {
			    pp.println("0"); 
			    pp.close(); 
			    return; 
			}
			int j = 0, prev = 0, count = 0, mk = 0, cur = 1; 
			while(j < c.length && cur < a.size() && prev < a.size()){
			    mk = a.get(cur)-j; 
			 //   pp.println("mk = " + mk + " cur= " + cur + " j = " + j+ " a.get  = " + a.get(cur)); 
			    if(mk > count)      count = mk; 
			    j = a.get(prev)+1; 
			    cur++; prev++;
			    
			}
			if(c.length - j > count)    count = c.length - j; 
			if(countg < count)
			pp.println(countg);
			else
			pp.println(count); 
		}
		pp.close(); 
	}
	public static int find() throws IOException {
		return 0; 
	}
	public static String index(String s, int i){
		return Character.toString(s.charAt(i)); 
	}
}
class in{
	ReaderClass sc = new ReaderClass(System.in);
	public int iin() throws IOException{
		int a = sc.nextInt(); 
		return a; 
	}
	public long lin() throws IOException{
		long a = sc.nextLong(); 
		return a; 
	}
	public double din() throws IOException{
		double a = sc.nextDouble(); 
		return a; 
	}
	public String sin() throws IOException{
		String a = sc.next(); 
		return a; 
	}

	public int[] iin(int n) throws IOException{
		int a[] = new int[n]; 
		for(int i = 0; i< n; i++){
			a[i] = sc.nextInt(); 
		}
		return a; 
	}
	public long[] lin(int n) throws IOException{
		long a[] = new long[n]; 
		for(int i = 0; i< n; i++){
			a[i] = sc.nextLong(); 
		}
		return a;
	}
	public char[] scin() throws IOException{
		String s = sc.next(); 
		char[] a = s.toCharArray(); 
		return a; 
	}
	public double[] din(int n) throws IOException{
		double a[] = new double[n]; 
		for(int i = 0; i< n; i++){
			a[i] = sc.nextDouble(); 
		}
		return a; 
	}
	public String[] sin(int n) throws IOException{
		String a[] = new String[n]; 
		for(int i = 0; i< n; i++){
			a[i] = sc.next(); 
		}
		return a; 
	}
	public ArrayList<Integer>  iinlist(int n) throws IOException{
		ArrayList<Integer> a = new ArrayList<>(); 
		for(int i = 0; i < n; i++){
			a.add(sc.nextInt()); 
		}
		return a; 
	}
	public ArrayList<Long>  linlist(int n) throws IOException{
		ArrayList<Long> a = new ArrayList<>(); 
		for(int i = 0; i < n; i++){
			a.add(sc.nextLong()); 
		}
		return a; 
	}
	public ArrayList<String>  sinlist(int n) throws IOException{
		ArrayList<String> a = new ArrayList<>(); 
		for(int i = 0; i < n; i++){
			a.add(sc.next()); 
		}
		return a; 
	}
	public ArrayList<Character> cinnlist(int n) throws IOException{
		ArrayList<Character> a = new ArrayList<>(); 
		String s = sc.next();
		for(int i = 0; i < n; i++){
			a.add(s.charAt(i)); 
		} 
		return a; 
	}
	public ArrayList<Double> dinlist(int n) throws IOException{
		ArrayList<Double> a = new ArrayList<>(); 
		for(int i = 0; i < n; i++){
			a.add(sc.nextDouble()); 
		}
		return a; 
	}
}
class out{
	public static void println(String [] s) throws IOException{
		for (int i = 0; i < s.length; i++) {
			System.out.println(s[i]); 
		}
	}
	public static void print(String [] s) throws IOException{
		for (int i = 0; i < s.length; i++) {
			System.out.print(s[i] + " "); 
		}
	}
	public static void print(int [] a) throws IOException {
		for(int i = 0; i < a.length; i++){
			System.out.print(a[i] + " "); 
		}
	}
	public static void println(int [] a) throws IOException {
		for(int i = 0; i < a.length; i++){
			System.out.println(a[i] + " "); 
		}
	}

	public static  void print(long [] a) throws IOException {
		for(int i = 0; i < a.length; i++){
			System.out.print(a[i] + " "); 
		}
	}
	public static  void print(double [] a) throws IOException {
		for(int i = 0; i < a.length; i++){
			System.out.print(a[i] + " "); 
		}
	}
	public static void print(char [] a) throws IOException {
		for(int i = 0; i < a.length; i++){
			System.out.print(a[i] + " "); 
		}
	}
	public static  void println(long [] a) throws IOException {
		for(int i = 0; i < a.length; i++){
			System.out.println(a[i] + " "); 
		}
	}
	public static  void println(double [] a) throws IOException {
		for(int i = 0; i < a.length; i++){
			System.out.println(a[i] + " "); 
		}
	}
	public static void println(char [] a) throws IOException {
		for(int i = 0; i < a.length; i++){
			System.out.println(a[i] + " "); 
		}
	}
	public static <E> void print(ArrayList<E> a){
		for(int i = 0; i<a.size(); i++){
			System.out.print(a.get(i)+" "); 
		}
	}
	public static <E> void println(ArrayList<E> a){
		for(int i = 0; i<a.size(); i++){
			System.out.println(a.get(i)+" "); 
		}
	}
}
class ReaderClass {
	    static BufferedReader reader;
	    static StringTokenizer tokenizer;

	    /** call this method to initialize reader for InputStream */
	   public ReaderClass(InputStream input) {
	        reader = new BufferedReader(
	                     new InputStreamReader(input) );
	        tokenizer = new StringTokenizer("");
	    }

	    /** get next word */
	    public String next() throws IOException {
	        while ( ! tokenizer.hasMoreTokens() ) {
	            tokenizer = new StringTokenizer(
	                   reader.readLine() );
	        }
	        return tokenizer.nextToken();
	    }

	    public int nextInt() throws IOException {
	        return Integer.parseInt( next() );
	    }
		
	    public double nextDouble() throws IOException {
	        return Double.parseDouble( next() );
	    }
	    public long nextLong() throws IOException{
	    	return Long.parseLong(next());
	    }
	    public String nextLine() throws IOException{
	    	return reader.readLine();
	    }
}
class str{
	
}
