#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, m = 0, x = 0;
  char c;
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> c;
    x += (c == 'I') * 2 - 1;
    m = max(m, x);
  }
  cout << m << endl;
}