#/bin/sh
read N
read S

x=0
ans=0
count=1

while [ $count -eq $N ]
do
 if [ `echo $S | cut -c $count` = "I" ]; then
   x=`expr $x + 1`
   ans=`expr $ans + 1`
   count=`expr $count + 1`
 elif [ `echo $S | cut -c $count` = "D" ]; then
   if [ $x -ne 0 ]; then
       x=`expr $x - 1`
       count=`expr $count + 1`
    fi
 fi
done

if [ $x -ne 0 ]; then
    echo $x
else
    echo $ans
fi