#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string st;
  cin >> st;
  long long lowest = 0, current = 0;
  for (auto ch : st) {
    if (ch == '+')
      current++;
    else if (ch == '-')
      current--;
    lowest = min(current, lowest);
  }
  cout << current - lowest << endl;
}
