#include //#include using namespace std; //using namespace atcoder; using ll = long long; //using mint = modint998244353; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); int N; cin >> N; string S; cin >> S; vector LM(N+2), RP(N+2); for (int i=1; i<=N; i++){ if (S[i-1] == '-') LM[i]++; LM[i] += LM[i-1]; } for (int i=N; i>=1; i--){ if (S[i-1] == '+') RP[i]++; RP[i] += RP[i+1]; } int ans=0; for (int i=1; i<=N; i++){ ans = max(ans, LM[i-1]+RP[i+1]+1); } cout << ans << endl; return 0; }