#include <bits/stdc++.h>
using namespace std;
const int eps = 1e-7;
const int INF = 0x3f3f3f3f;
const int mod = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int now = 0, cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '+') {
      now++;
    } else {
      if (now == 0) {
        cnt++;
      } else {
        now--;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (s[i] == '+') {
      cnt++;
    } else {
      cnt--;
    }
  }
  cout << cnt << endl;
}
