#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N;
  cin >> S;
  int ans = N;
  bool tf = false;
  for (int i = 0; i < N; i++) {
    if (S[i] == 'S')
      tf = true;
    else if (tf)
      ans = ans - 2;
  }
  cout << abs(ans) << endl;
}
