#import <stdio.h>
#define MAX(a,b) ((a)>(b)?(a):(b))
int main() {
    int n;
    char S[200];
    scanf("%d %s", &n, S);
    int x=0;
    int max=0;
    for (int a=0;a<n;a++){
        if (S[a]=='I') {
            x++;
            max = MAX(max,x);
            continue;
        }
        x--;
    }
    printf("%d", max);
}
