#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, c = 0, d = 0, k;     string str;     cin >> n >> str;     for (int i = 0; i < n; i++) {       if (str[i] ==  - ) c++;     }     if (c == n) {       cout << 0 << endl;       return 0;     } else if (str[0] ==  - ) {       for (int i = 0; i < n; i++) {         if (str[i] ==  - ) {           continue;         } else {           k = i;           break;         }       }       for (int i = k; i < n; i++) {         if (str[i] ==  + )           d += 1;         else {           d -= 1;           if (d < 0) d = 0;         }       }     } else {       for (int i = 0; i < n; i++) {         if (str[i] ==  + )           d += 1;         else {           d -= 1;           if (d < 0) d = 0;         }       }     }     cout << d << endl;     return 0;   }   