#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using P = pair<int, int>;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int x = 0;
  for (int i = 0; i < (int)(N); i++) {
    int tmp = 0;
    for (int j = 0; j < (int)(i + 1); j++) {
      if (S[j] == 'I')
        tmp++;
      else
        tmp--;
    }
    x = max(x, tmp);
  }
  cout << x << endl;
}
