#include <bits/stdc++.h>
int max(int x, int y) { return x > y ? x : y; }
char str[100001];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", str);
  int cnt = 0, maxn = 0, k = 0, sum = 0;
  for (int i = 0; i < n; i++) {
    if (str[i] == 'S') {
      cnt = k, k = 0;
    } else {
      k++, sum++;
    }
    maxn = max(maxn, cnt + k + 1);
  }
  if (maxn > sum) maxn--;
  printf("%d\n", maxn);
}
