#include <bits/stdc++.h>
using namespace std;
const int N=200000+5;
int n,a[N],cnt=0;
char s[N];
int main(){
freopen ("photoshoot_bronze_22open.in","r",stdin);
freopen ("photoshoot_bronze_22open.out","w",stdout);
scanf("%d",&n);
scanf("%s",s+1);
for (int i=1;i<=n;i+=2){
if (s[i]=='G'&&s[i+1]=='G')continue;
if (s[i]=='G')a[++cnt]=i;
if (s[i+1]=='G')a[++cnt]=i+1;
}
int ans=0,lst=-1;
for (int i=1;i<=cnt;i++){
if (a[i]%2!=lst)ans++,lst=a[i]%2;
}
if (lst==0)ans--;
printf("%d\n",ans);
return 0;
}