#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long mini = 0, pos = -1;
  long long bal = 0;
  for (long long i = 0; i < n; i++) {
    mini += s[i] == '+';
    mini -= s[i] == '-';
    if (bal > mini) {
      bal = mini;
      pos = i;
    }
  }
  long long kek = 0;
  for (long long i = pos + 1; i < n; i++) {
    kek += s[i] == '+';
    kek -= s[i] == '-';
  }
  cout << kek;
  return 0;
}
