N = int(input()) dp = [0] * 3 for s in input(): new_dp = dp[:] if s == "-": new_dp[0] = max(new_dp[0], dp[0] + 1) elif s == "0": new_dp[1] = max(new_dp[1], dp[0] + 1) else: new_dp[2] = max(new_dp[2], dp[1] + 1) new_dp[2] = max(new_dp[2], dp[2] + 1) dp = new_dp print(max(dp))