N = int(input()) S = input() dp = [0, -1, -1] for c in S: if c == '+': dp[2] = max(dp) + 1 if c == '0': dp[1] = dp[0] + 1 if c == '-': dp[0] += 1 print(max(dp))