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 sys
sys.setrecursionlimit(2000)
from collections import Counter


def solution(n, a):

    new_a = []
    # do one level of contraction
    summ = 0
    for i in a:
        summ += i
        if(i == 0):
            if(summ != 0):
                new_a.append(summ)
            new_a.append(i)
            summ = 0

    if(summ != 0):
        new_a.append(summ)

#    print(a)
    a = new_a
#    print(a)

    # index the gold patches
    gind = 0
    golds = {}
    edges = []
    for ind, val in enumerate(a):
        if(val != 0):
            golds[gind] = val
            gind += 1
        else: # test for bridge
            if(ind != 0 and a[ind-1] != 0 and
                ind != len(a)-1 and a[ind+1] != 0):
                edges.append([gind-1, gind])

#    print(golds)
#    print(edges)

    # golds index each patch of gold
    # edges contain edgs where a gold can meet another gold patch
    best = 0
    if(len(edges) != 0): # there is at least two gold patches, and they connect
    
        for ind1, ind2 in edges:
        
            val = golds[ind1] + golds[ind2] 
            if(len(golds) > 2):
                val += 1
            best = max(best, val)

        
    if(len(golds) == 0):
        val = 0
    else:
        val = max([val for key, val in golds.items()])
        if(len(golds) != 1):
            val += 1

    best = max(best, val)

    print(best) 
    return best

#from random import seed
#from random import randint
#def validate():
#
#    for s in range(10):
#        
#        seed(s)
#        a = [randint(0, 1) for i in range(10)]
#        val1 = solution(len(a), a)
#
#        print(a, val1)
        

if __name__ == "__main__":

    # single variables
    n = [int(val) for val in input().split()][0]

    # vectors
    a = [1 if val == 'G' else 0 for val in input()]

    # solve it!
    solution(n, a)

#    validate()


