Vasya has a pile, that consists of some number of stones. $$$n$$$ times he either took one stone from the pile or added one stone to the pile. The pile was non-empty before each operation of taking one stone from the pile.You are given $$$n$$$ operations which Vasya has made. Find the minimal possible number of stones that can be in the pile after making these operations.

The first line contains one positive integer $$$n$$$ — the number of operations, that have been made by Vasya ($$$1 \leq n \leq 100$$$). The next line contains the string $$$s$$$, consisting of $$$n$$$ symbols, equal to "-" (without quotes) or "+" (without quotes). If Vasya took the stone on $$$i$$$-th operation, $$$s_i$$$ is equal to "-" (without quotes), if added, $$$s_i$$$ is equal to "+" (without quotes).

Print one integer — the minimal possible number of stones that can be in the pile after these $$$n$$$ operations.

NoteIn the first test, if Vasya had $$$3$$$ stones in the pile at the beginning, after making operations the number of stones will be equal to $$$0$$$. It is impossible to have less number of piles, so the answer is $$$0$$$. Please notice, that the number of stones at the beginning can't be less, than $$$3$$$, because in this case, Vasya won't be able to take a stone on some operation (the pile will be empty).In the second test, if Vasya had $$$0$$$ stones in the pile at the beginning, after making operations the number of stones will be equal to $$$4$$$. It is impossible to have less number of piles because after making $$$4$$$ operations the number of stones in the pile increases on $$$4$$$ stones. So, the answer is $$$4$$$.In the third test, if Vasya had $$$1$$$ stone in the pile at the beginning, after making operations the number of stones will be equal to $$$1$$$. It can be proved, that it is impossible to have less number of stones after making the operations.In the fourth test, if Vasya had $$$0$$$ stones in the pile at the beginning, after making operations the number of stones will be equal to $$$3$$$.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class CF1159A {
    public static void main(String[] args) {
       FastReader input = new FastReader();
       int n = input.nextInt();
       String s = input.nextLine();
       int sum = 0;
       for(int i = 0;i < s.length();i++){
           if(sum == 0 && s.charAt(i) == '-')
               sum = 0;
           else{
               if(s.charAt(i) == '-')
                   sum--;
               else
                   sum++;
           }
       }
        System.out.println(sum);
    }
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.io.*;
import java.lang.*;
import java.util.Scanner;

public class GFG {

    public static void main(String args[])

    {
      Scanner sc=new Scanner(System.in);
      int n=sc.nextInt();int ctr1=0;
        String str=sc.nextLine();
      String s=sc.nextLine();
      for(int i=0;i<n;i++)
      {
          if(s.charAt(i)=='+')
          ctr1++;
          else
          ctr1--;
          if(ctr1<0)
          ctr1++;
      }
      System.out.println(ctr1);
    }
}

import java.util.*;
public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int[] arr = new int[N];
        String g = in.next();
        for(int i = 0; i < N; i++) {
            arr[i] = (g.charAt(i) == '+') ? 1 : -1;
        }

        int min = 0;
        int sum = 0;
        for(int i : arr) {
            sum += i;
            if(sum < min) {
                min = sum;
            }
        }

        System.out.println(sum - min);
    }
}

// import java.io.*;
// import java.util.*;

// public class C2 {
//     public static void main(String[] args) throws IOException {
//         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//         StringTokenizer st = new StringTokenizer(br.readLine());
//         int n = Integer.parseInt(st.nextToken());
//         int k = Integer.parseInt(st.nextToken());
//         if (n < (long) k * (k + 1) / 2 || k == 2 && n == 4 || k == 3 && n == 8) {
//             System.out.println("NO");
//             return;
//         }
//         System.out.println("YES");
//         if (k == 1) {
//             System.out.println(n);
//             return;
//         }
//         int[] aa = new int[1 + k];
//         n -= k * (k + 1) / 2;
//         int m = n / k, r = n % k;
//         for (int i = 1; i <= k; i++)
//             aa[i] = m + i + (i + r > k ? 1 : 0);
//         if (n == k - 1) {
//             aa[2]--;
//             aa[k]++;
//         }
//         StringBuilder sb = new StringBuilder();
//         for (int i = 1; i <= k; i++)
//             sb.append(aa[i] + " ");
//         System.out.println(sb);
//     }
// }package Round558;
// public class B1163{
// 	public static void main(String[] args) {
// 		Scanner sc=new Scanner(System.in);
// 		int n,i,ans=0,colour,max=0;
// 		n=sc.nextInt();
// 		int fr[]=new int[100001];
// 		int count[]=new int[100001];
// 		for(i=0;i<n;i++){
// 			colour=sc.nextInt();
// 			count[fr[colour]]--;
// 			fr[colour]++;
// 			count[fr[colour]]++;
// 			max=Math.max(max,fr[colour]);
// 			if((count[1]==i+1)
// 				||(count[i+1]==1)
// 				||((count[1]==1)&&((count[max]*max)==i))
// 				||((count[max]==1)&&(((count[max-1]+1)*(max-1))==i)))
// 				ans=i;
// 		}
// 		System.out.println(ans+1);
// 	}
// }
import java.util.Scanner;
public class A{
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        char[] a = s.toCharArray();
        int ans = 0;
        for (int i = 0 ; i < a.length ; i ++) {
            if (a[i]=='+') ans++;
            else ans--;
            if (ans<0) ans=0;
        }
        System.out.println(ans);
    }
}

import java.util.*;
import java.io.*;
public class A {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        int res = 0;
        int n = Integer.parseInt(f.readLine());
        String in = f.readLine();

        for (int i = 0; i < n; i++) {
            if(in.charAt(i) == '+') res++;
            else res--;
            if(res < 0) res++;
        }

        System.out.println(res);
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner e = new Scanner(System.in);

		int n = e.nextInt();
		String line = e.next();

		int p = 0, m = 0;
		for(int i = 0; i < n; i++)
		{
			if(line.charAt(i) == '+')
				p++;
			else
			{
				if(p == 0)
					continue;
				else
					p--;
			}
		}

		if(p <= 0)
			System.out.println("0");
		else
			System.out.println(p);

	}
}

import java.util.*;
import static java.lang.Math.*;
public class Demo{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		String s = in.next();
		int count=0;
		for (int i = 0; i < s.length(); i++){
			if(s.charAt(i)=='+'){count++;}else{count--;}
			count = count<0? 0:count;
		}

		System.out.println(count);
	}
}

import java.util.*;
import java.lang.*;
import java.io.*;

public final class Main {

	public static void main (String[] args) throws java.lang.Exception {
	    Scanner in=new Scanner(System.in);
	        int n=in.nextInt();
	      String input=in.next();
	      int ans=0;
	      int add=0,out=0;
	      boolean flag=true;
	      for(char c:input.toCharArray()){
	        if(c=='+'){
	            ans++;
	        }
	        else{
	            ans--;
	        }
	        if(ans<0)
	            ans=0;
	      }

	       System.out.println(ans);

	}

}

import java.util.Scanner;
public class a{
    public static void main(String args[]){
        Scanner s = new Scanner(System.in);
        int len = s.nextInt();
        int count = 0;
        char c[]= s.next().toCharArray();
        int idx = 0;
        if(c[idx]=='-'){
            while(idx<c.length && c[idx]=='-')
                idx++;
        }
        for(int i=idx;i<c.length;i++){
            if(c[i]=='+')count++;
            else count--;
            if(count<0) count=0;
        }
        System.out.println(count);
    }
}

import java.util.*;
public class stone
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int m,count=0;
        String s;
        m=sc.nextInt();
        s=sc.next();
        for(int i=0;i<m;i++)
        {
            if(s.charAt(i)=='-') count--;
            if(count<0) count=0;
            if(s.charAt(i)=='+') count++;
        }
        System.out.println(count);
        sc.close();
    }
}

import java.util.Scanner;
public class sol{
	public static void main(String[] args) {
		Scanner input  = new Scanner(System.in);

		int n = input.nextInt();

		String s = input.next();

		int ans=0;
		int m =0;
		for(int i=n-1;i>=0;i--)
		{
		    if(s.charAt(i)=='+')
		        ans++;
		    else
		        ans--;

		    m  =Math.max(ans,m);
		}
	System.out.println(m);
	}
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner cv=new Scanner(System.in);
        cv.nextLine();
        String line=cv.nextLine();
        int minus=0,plus=0,a=0;
        for (int i = 0; i < line.length() ; i++) {
            if(line.charAt(i)=='+'){
                a++;
            }else
                if(a>0){
                    a--;
                }else
                    continue;
        }
        System.out.println(a);
    }
}

//package codeforces;
import java.util.Scanner;
public class ex5 {
public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int x=0;
	int n= scan.nextInt();
	String s = scan.next();
	if(s.charAt(0)=='+') {x=0;}
	else {
		x=1;
	}
	for (int i = 0; i < s.length(); i++) {
		if(s.charAt(i)=='+') x++;
		else x--;
		if(x<0) x++;
	}

	if(x<0) System.out.println(0);
	else System.out.println(x);
}
}

import java.util.*;
import java.io.*;
import java.math.*;
public class mmm
{
    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;
        public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        }

        public String next()
        {
            while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

        public long nextLong()
        {
            return Long.parseLong(next());
        }
    }
    static class card{
        long l;
        long r;
        int in;
        public card(long ch,long i,int in)
        {
            this.l=ch;
            this.r=i;
            this.in=in;
        }
    }
    static class sort implements Comparator<card>
    {
        public int compare(card o1,card o2)
        {
            if(o1.l!=o2.l)
                return (int)(o1.l-o2.l);
            else
                return (int)(o1.r-o2.r)*-1;
        }
    }
    static void shuffle(long a[])
    {
    List<Long> l=new ArrayList<>();
    for(int i=0;i<a.length;i++)
    l.add(a[i]);
    Collections.shuffle(l);
    for(int i=0;i<a.length;i++)
    a[i]=l.get(i);
    }

    /*static long gcd(long a,long b)
    {
    if(b==0)
    return a;
    else
    return gcd(b,a%b);
    }
    static int ans1=Integer.MAX_VALUE,ans2=Integer.MAX_VALUE,ans3=Integer.MAX_VALUE,ans4=Integer.MAX_VALUE;
    static boolean v[]=new boolean[101];
    static void dfs(Integer so,Set<Integer> s[]){
    if(!v[so.intValue()])
    {
    v[so]=true;
    for(Integer h:s[so.intValue()])
    {
    if(!v[h.intValue()])
    dfs(h,s);
    }
    }
    }
    static class Print{
    public PrintWriter out;
    Print(OutputStream o)
    {
    out=new PrintWriter(o);
    }
    }
    static int CeilIndex(int A[], int l, int r, int key)
    {
    while (r - l > 1) {
    int m = l + (r - l) / 2;
    if (A[m] >= key)
    r = m;
    else
    l = m;
    }

    return r;
    }

    static int LongestIncreasingSubsequenceLength(int A[], int size)
    {
    // Add boundary case, when array size is one
    int[] tailTable = new int[size];
    int len; // always points empty slot
    tailTable[0] = A[0];
    len = 1;
    for (int i = 1; i < size; i++) {
    if (A[i] < tailTable[0])
    // new smallest value
    tailTable[0] = A[i];

    else if (A[i] > tailTable[len - 1])
    // A[i] wants to extend largest subsequence
    tailTable[len++] = A[i];

    else
    // A[i] wants to be current end candidate of an existing
    // subsequence. It will replace ceil value in tailTable
    tailTable[CeilIndex(tailTable, -1, len - 1, A[i])] = A[i];
    }
    return len;
    }*/
    /*static int binary(int n)
    {
    int s=1;
    while(n>0)
    {
    s=s<<1;
    n--;
    }
    return s-1;
    }
    static StringBuilder bin(int i,int n)
    {
    StringBuilder s=new StringBuilder();
    while(i>0)
    {
    s.append(i%2);
    i=i/2;
    }
    while(s.length()!=n)
    {
    s.append(0);
    }
    return s.reverse();
    }*/
    static boolean valid(int i,int j,int n,int m)
    {
        if(i<n && i>=0 && j<m && j>=0)
        return true;
        else
        return false;
    }
    public static void main(String[] args)
    {
        InputReader sc=new InputReader(System.in);
        int n=sc.nextInt();
        char a[]=sc.next().toCharArray();
        int c=0,f=0;
        List<Integer> l=new ArrayList();
        if(a[0]=='+')
        l.add(1);
        else
        l.add(-1);
        int n1=1;
        for(int i=1;i<n;i++)
        {
           if(a[i]=='+' && a[i-1]=='+')
           l.add(l.get(n1-1)+1);
           else if(a[i]=='+' && a[i-1]=='-')
           l.add(l.get(n1-1)+1);
           else if(a[i]=='-' && a[i-1]=='+')
           l.add(l.get(n1-1)-1);
           else
           l.add(l.get(n1-1)-1);
           n1++;
        }
        int min=Integer.MAX_VALUE;
        for(int i=0;i<l.size();i++)
        {
            min=Math.min(min,l.get(i));
        }
        int t=Math.abs(Math.min(min,0));
        for(int i=0;i<n;i++)
        {
            if(a[i]=='+')
            t++;
            else
            t--;
        }
        System.out.println(t);
    }
}

import java.util.Scanner;
public class Piles {
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        sc.nextLine();
        String a = sc.nextLine();
        int sum = 0;
        for(int i=0;i<t;i++)
        {
            if(a.charAt(i)=='-')
            {
                if(sum<=0)
                    sum=0;
                else
                {
                    sum-=1;
                }
            }
            else if(a.charAt(i)=='+')
            {
                sum+=1;
            }
        }
        System.out.println(sum);
    }
}

import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
	//static final long MOD = 998244353;
	static final long MOD = 1000000007;
	static boolean[] visited;
    public static void main(String[] args) throws IOException {
        FastScanner sc = new FastScanner();
        int N = sc.nextInt();
        String s = sc.next();
        int[] changes = new int[N];
        for (int i = 0; i < N; i++) {
        	if (s.charAt(i)=='-')
        		changes[i] = -1;
        	else
        		changes[i] = 1;
        }
        int low = 0;
        int high = 100;
        while (low < high) {
        	int mid = (low+high)/2;
        	int stones = mid;
        	boolean possible = true;
        	for (int i = N-1; i >= 0; i--) {
        		stones -= changes[i];
        		if (stones < 0) {
        			possible = false;
        			break;
        		}
        	}
        	if (possible) {
        		high = mid;
        	} else {
        		low = mid+1;
        	}
        }
        System.out.println(low);
    }

    public static int[] base26(int N, int num) {
    	int[] ans = new int[N];
    	for (int i = N-1; i >= 0; i--) {
    		int pow = (int)Math.pow(26,i);
    		ans[i] = num/pow;
    		num -= ans[i]*pow;
    	}
    	return ans;
    }

    public static int[][] sort(int[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i< array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
			  public int compare(int[] arr1, int[] arr2) {
				  //Descending order
				  return arr2[0]-arr1[0];
			  }
		});
		return array;
	}

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

class Node {
	public HashSet<Node> children;
	public int n;

	public Node(int n) {
		this.n = n;
		children = new HashSet<Node>();
	}

	public void addChild(Node node) {
		children.add(node);
	}

	public void removeChild(Node node) {
		children.remove(node);
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		return n;
	}

	@Override
	public boolean equals(Object obj) {
		if (! (obj instanceof Node)) {
			return false;
		} else {
			Node node = (Node) obj;
			return (n == node.n);
		}
	}

	public String toString() {
		return (this.n+1)+"";
	}
}

import  java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.*;
import java.math.*;
import java.io.*;
import java.text.*;

public class Main
{

    public static boolean[] sieve(long n)
    {
        boolean[] prime = new boolean[(int)n+1];
        Arrays.fill(prime,true);
        prime[0] = false;
        prime[1] = false;
        long m = (long)Math.sqrt(n);
        for(int i=2;i<=m;i++)
        {
            if(prime[i])
            {
                for(int k=i*i;k<=n;k+=i)
                {
                    prime[k] = false;
                }
            }
        }
        return prime;
    }

    static long GCD(long a,long b)
    {
        if(a==0 || b==0)
        {
            return 0;
        }
        if(a==b)
        {
            return a;
        }
        if(a>b)
        {
            return GCD(a-b,b);
        }
        return GCD(a,b-a);
    }

    static long CountCoPrimes(long n)
    {
        long res = n;
        for(int i=2;i*i<=n;i++)
        {
            if(n%i==0)
            {
                while(n%i==0)
                {
                    n/=i;
                }
                res-=res/i;
            }
        }
        if(n>1)
        {
            res-=res/n;
        }
        return res;
    }

    //fastest way to find x**n
    static long modularExponentiation(long x,long n,long m)
    {
        long res = 1;
        while(n>0)
        {
            if(n%2==1)
            {
                res = (res*x)%m;
            }
            x =(x*x)%m;
            n/=2;
        }
        return res;
    }

    static long lcm(long a,long b)
    {
        return (a*b)/GCD(a,b);
    }

    static long pow(long a,long b)
    {
        long res = 1;
        while(b>0)
        {
            if((b&1)==1)
            {
                res *= a;
            }

            b >>= 1;
            a *=a;
        }
        return res;
    }

   static long modInverse(long A,long M)
   {
    return modularExponentiation(A,M-2,M);
   }

    static boolean prime(int n)
    {
        for(int i=2;i*i<=n;i++)
        {
            if(i%2==0 ||i%3==0)
            {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) throws IOException
    {

        new Main().run();

    }

    static void reverse(long[] a,long n)
    {
        int start=0;
        int end = (int)n;
        while(start!=end)
        {
            long temp = a[start];
            a[start] = a[end];
            a[end] = temp;
            start++;
            end--;
        }
    }

    static long findGCD(ArrayList<Long> arr, long n)
    {
        long result = arr.get(0);
        for (int i = 1; i < n; i++)
            result = GCD(arr.get(i), result);

        return result;
    }

    static Scanner in = new Scanner(System.in);
    static void run() throws IOException
    {
       int n = ni();
       char[] c = si().toCharArray();
       int minus=0;
       for(int i=0;i<n;i++)
       {
            if(c[i]=='-')
            {
                minus--;
            }
            else
            {
                minus++;
            }
            if(minus<0)
            {
                minus=0;
            }
       }

      if(minus<0)
      {
            printL(0);
      }
       else
       {
            printL(minus);
       }

    }

    //xor range query
    static long xor(long n)
    {

        if(n%4==0)
        {
            return n;
        }
        if(n%4==1)
        {
            return  1;
        }
        if(n%4==2)
        {
            return n+1;
        }
        return 0;
    }

    static long xor(long a,long b)
    {
        return xor(b)^xor(a-1);
    }

    static void printL(long a)
    {
        System.out.println(a);
    }
    static void printS(String s)
    {
        System.out.println(s);
    }

    static void printD(Double d)
    {
        System.out.println(d);
    }

    static void swap(char c,char p)
    {
        char t = c;
        c = p;
        p = t;
    }

    static long max(long n,long m)
    {
        return Math.max(n,m);
    }
    static long min(long n,long m)
    {
        return Math.min(n,m);
    }

    static double nd() throws IOException
    {
        return Double.parseDouble(in.next());
    }
    static int ni() throws IOException
    {
        return Integer.parseInt(in.next());
    }

    static long nl() throws IOException
    {
        return Long.parseLong(in.next());
    }

    static String si() throws IOException
    {
        return in.next();
    }

    static int abs(int n)
    {
        return Math.abs(n);
    }

    static class Scanner
    {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){  br = new BufferedReader(new InputStreamReader(s));}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
            {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        public int nextInt() throws IOException {return Integer.parseInt(next());}

        public long nextLong() throws IOException {return Long.parseLong(next());}

        public String nextLine() throws IOException {return br.readLine();}

        public boolean ready() throws IOException {return br.ready();}

    }

}

class Pair implements Comparable<Pair>
{
    int x;
    int y;
    public Pair(int x,int y)
    {
        this.x = x;
        this.y = y;
    }
    public int compareTo(Pair o)
    {
        return this.x-o.x;
    }
}

import java.io.InputStream;
import java.util.*;

public class CFMain {
    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);

        int n = in.readInt();
        String s = in.readLine();

        int sum = 0;

        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == '+') {
                sum++;
            } else {
                sum = Math.max(0, sum - 1);
            }
        }

        System.out.println(sum);
    }
}

class InputReader {
    private Scanner scanner;

    InputReader(InputStream inputStream) {
        this.scanner = new Scanner(inputStream);
    }

    int readInt() {
        return scanner.nextInt();
    }

    long readLong() {
        return scanner.nextLong();
    }

    String readLine() {
        return scanner.next(); // fixme: has problems with line endings.
    }

    int[] readIntArray(int arrayLength) {
        int[] array = new int[arrayLength];
        for (int i = 0; i < arrayLength; i++) {
            array[i] = scanner.nextInt();
        }

        return array;
    }
}

/*Author: Satyajeet Singh, Delhi Technological University*/
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import java.lang.*;
    import java.math.*;

public class Main{
/*********************************************Constants******************************************/
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static long mod=(long)1e9+7;
    static long mod1=998244353;
    static boolean sieve[];
    static ArrayList<Integer> primes;
    static ArrayList<Long> factorial;
    static HashSet<Pair> graph[];
/****************************************Solutions Begins***************************************/
    public static void main (String[] args) throws Exception {
        String st[]=br.readLine().split(" ");
        int n=Integer.parseInt(st[0]);
        st=br.readLine().split(" ");
        String str=st[0];
        int a=0;
        for(int i=0;i<n;i++){
            if(str.charAt(i)=='-'){
                a--;
            }
            else{
                a++;
            }
            if(a<0){
                a=0;
            }
        }
        out.println(Math.max(a,0));
/****************************************Solutions Ends**************************************************/
        out.flush();
        out.close();
    }

/****************************************Template Begins************************************************/
/***************************************Precision Printing**********************************************/
    static void printPrecision(double d){
        DecimalFormat ft = new DecimalFormat("0.00000000000000000");
        out.println(ft.format(d));
    }
/******************************************Graph*********************************************************/
    static void Makegraph(int n){
        graph=new HashSet[n];
        for(int i=0;i<n;i++){
            graph[i]=new HashSet<>();
        }
    }
    static void addEdge(int a,int b,int c){
        graph[a].add(new Pair(b,c));
    }
/*********************************************PAIR********************************************************/
    static class PairComp implements Comparator<Pair>{
        public int compare(Pair p1,Pair p2){
            return p2.v-p1.v;
        }
    }
    static class Pair implements Comparable<Pair> {
        int u;
        int v;
        int index=-1;
        public Pair(int u, int v) {
            this.u = u;
            this.v = v;
        }

        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }

        public boolean equals(Object o) {
            Pair other = (Pair) o;
            return u == other.u && v == other.v;
        }

        public int compareTo(Pair other) {
            if(index!=other.index)
                return Long.compare(index, other.index);
            return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);
        }

        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/******************************************Long Pair*************************************************/
    static class PairCompL implements Comparator<Pairl>{
        public int compare(Pairl p1,Pairl p2){
            if(p1.v>p2.v){
                return -1;
            }
            else if(p1.v<p2.v){
                return 1;
            }
            else{
                return 0;
            }
        }
    }
    static class Pairl implements Comparable<Pair> {
            long u;
            long v;
            int index=-1;
            public Pairl(long u, long v) {
                this.u = u;
                this.v = v;
            }

            public int hashCode() {
                int hu = (int) (u ^ (u >>> 32));
                int hv = (int) (v ^ (v >>> 32));
                return 31 * hu + hv;
            }

            public boolean equals(Object o) {
                Pair other = (Pair) o;
                return u == other.u && v == other.v;
            }

            public int compareTo(Pair other) {
                if(index!=other.index)
                    return Long.compare(index, other.index);
                return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);
            }

            public String toString() {
                return "[u=" + u + ", v=" + v + "]";
            }
        }
/*****************************************DEBUG***********************************************************/
    public static void debug(Object... o) {
        System.out.println(Arrays.deepToString(o));
    }
/************************************MODULAR EXPONENTIATION***********************************************/
    static long modulo(long a,long b,long c) {
        long x=1;
        long y=a;
        while(b > 0){
            if(b%2 == 1){
                x=(x*y)%c;
            }
            y = (y*y)%c; // squaring the base
            b /= 2;
        }
        return  x%c;
    }
/********************************************GCD**********************************************************/
    static long gcd(long x, long y)
    {
        if(x==0)
            return y;
        if(y==0)
            return x;
        long r=0, a, b;
        a = (x > y) ? x : y; // a is greater number
        b = (x < y) ? x : y; // b is smaller number
        r = b;
        while(a % b != 0)
        {
            r = a % b;
            a = b;
            b = r;
        }
        return r;
    }
/******************************************SIEVE**********************************************************/
    static void sieveMake(int n){
        sieve=new boolean[n];
        Arrays.fill(sieve,true);
        sieve[0]=false;
        sieve[1]=false;
        for(int i=2;i*i<n;i++){
            if(sieve[i]){
                for(int j=i*i;j<n;j+=i){
                    sieve[j]=false;
                }
            }
        }
        primes=new ArrayList<Integer>();
        for(int i=0;i<n;i++){
            if(sieve[i]){
                primes.add(i);
            }
        }
    }
/********************************************End***********************************************************/
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner s=new Scanner(System.in);
	    int n=s.nextInt();
	    String str=s.next();
	    int ans=0;
	    for(int i=0;i<n;i++)
	    {
	        if(str.charAt(i)=='-'&&ans>=0)
	        ans--;
	        if(str.charAt(i)=='+'&&ans>=0)
	        ans++;
	        if(ans<0)
	        ans=0;
	    }
	    System.out.println(ans);
	}
}

import java.util.*;
public class Stoned {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt(),m=0;
		String x = scan.next();
		for(int i=0;i<x.length();i++)
		{
			if(x.charAt(i)=='+')m++;
			else m--;
			if(m<0)m++;
		}
		System.out.println(m);
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class CR559A {

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}

		String next()
		{
			while (st == null || !st.hasMoreElements())
			{
				try
				{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException  e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}

		long nextLong()
		{
			return Long.parseLong(next());
		}

		double nextDouble()
		{
			return Double.parseDouble(next());
		}

		String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) {

		FastReader sc = new FastReader();
	    OutputStream outputstream = System.out;
	    PrintWriter out = new PrintWriter(outputstream);

	    int n = sc.nextInt();
	    String str = sc.next();
	    int ans = 0;
	    for(int i = 0; i < n; i++) {
	    	if(str.charAt(i)=='+') {
	    		for(int j = i; j < n; j++) {
	    			if(str.charAt(j)=='+') ans++;
	    			else ans--;
	    			if(ans<0) ans = 0;
	    		}
	    		break;
	    	}
	    }
	    out.println(ans);
	    out.close();

	}

}

import java.util.ArrayList;
import java.util.*;

//Code:-
public class code1 {
	static long n=3000000;
	static boolean isPrime[];
	public static ArrayList<Integer> seive()
	{
		isPrime=new boolean[(int)n];

		for(int i=0;i<n;i++)
		{
			isPrime[i]=true;
		}

		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i])
			{
				for(int j=i;j<n;j+=i)
				{
					isPrime[j]=false;
				}
			}
		}
		ArrayList<Integer>primes=new ArrayList<>();
		for(int i=2;i<n;i++)
		{
			if(isPrime[i])
			{
				primes.add(i);
			}
		}
		return primes;
	}

	public static long factor(long a)
	{
		long max=-1;
		for(int i=2;i*i<=a;i++)
		{
			if(a%i==0)
			{
				max=Math.max(i,a/i);
			}
		}
		return max;
	}

	public static void main(String args[]){
	Scanner s=new Scanner(System.in);
	int n=s.nextInt();
	n=0;
	String str=s.next();
	int min=n;
	for(int i=0;i<str.length();i++)
	{
		char c=str.charAt(i);
		if(c=='-')
			n--;
		else
			n++;
		if(n<0)
			n=0;
		//min=Math.min(n,min);
	}
	System.out.println(n);
	s.close();
	}

	static class Pair{
		int x;int y;
		Pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}
	}
}
/*class MyComparator implements Comparator<Pair>
{
public int compareTo()
{
	return ;
}
}*/

//sorted in inc. order

import java.io.*;
import java.util.*;

public class cf
{
    public static void main(String[] args)
    {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        String s=in.nextLine();
        s=in.nextLine();int min=0;
        for(int i=0;i<n;i++)
            if(s.charAt(i)=='+')
                min++;
            else
            {
                min--;
                min=Math.max(min,0);
            }
        System.out.println(min);
    }
}

import java.util.Scanner;

public class Main{
public static void main(String args[]){
	Scanner in=new Scanner(System.in);
	int n=in.nextInt();
	in.nextLine();
	String s=in.nextLine();
	int add =0;
	for(int i=0;i<n;i++){
	if(s.charAt(i) =='-'){
		if(add > 0)
			add--;
    }
    else{
	    add++;
    }
    }
    System.out.println(add);
}
}

import java.io.*;
import java.util.*;

public class codeforces {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        char s[] = scan.next().toCharArray();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (s[i] == '+') ans++;
            else {
                ans--;
                ans = Math.max(0, ans);
            }
        }
        System.out.println(ans);
    }
}

import java.util.*;
public class Main
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);

            int n=sc.nextInt();
            String s=sc.next();
            int sum=0;
            int i=0;
            if (s.charAt(0)=='-')
            {
                for(i=0;i<n;i++)
                {
                    if(s.charAt(i)!='-')
                        break;
                }
            }
            int j;
            for(j=i;j<n;j++)
            {
                if(s.charAt(j)=='-')
                {
                    sum -= 1;
                    if (sum < 0)
                        sum = 0;
                }
                else
                    sum+=1;
            }
            System.out.print(sum);
        }
    }

import java.util.*;
public class stone
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int m,count=0;
        String s;
        m=sc.nextInt();
        s=sc.next();
        for(int i=0;i<m;i++)
        {
            if(s.charAt(i)=='-') count--;
            if(count<0) count=0;
            if(s.charAt(i)=='+') count++;
        }
        System.out.println(count);
        sc.close();
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;

public final class Main {

	public static void main (String[] args) throws java.lang.Exception {
	    Scanner in=new Scanner(System.in);
	        int n=in.nextInt();
	      String input=in.next();
	      int ans=0;
	      int add=0,out=0;
	      boolean flag=true;
	      for(char c:input.toCharArray()){
	        if(c=='+'){
	            ans++;
	        }
	        else{
	            ans--;
	        }
	        if(ans<0)
	            ans=0;
	      }

	       System.out.println(ans);

	}

}

import java.util.Scanner;

public class A {

	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		String s = sc.next();

		int stones = 0;
		boolean start = false;
		for(int i = 0; i < s.length(); i++)
		{
			boolean plus = s.charAt(i) == '+';

			if(start)
			{
				if(plus)
				{
					stones++;
				}
				else
				{
					stones--;
					if(stones < 0)stones = 0;
				}
			}
			if(!start)
			{
				if(plus)
				{
					start = true;
					stones++;
				}
			}

		}

		System.out.println(stones);

	}

}

import java.util.Scanner;

public class A1159 {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		int cnt1=0;
		for(int i=0;i<n;i++)
		{
			if(s.charAt(i)=='+')
			{
				cnt1++;
				//cnt=0;
			}
			else
			{
				if(cnt1==0);
				else
				cnt1--;
				//cnt2++;
			}
		}

			System.out.println(cnt1);

	}
}

import java.util.*;
import java.io.*;
import java.math.*;
public class loser
{
    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;
        public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        }

        public String next()
        {
            while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

        public long nextLong()
        {
            return Long.parseLong(next());
        }
    }
    static class card{
        int l;
        int r;
        public card(int ch,int i)
        {
            this.l=ch;
            this.r=i;
        }
    }
    static class sort implements Comparator<card>
    {
        public int compare(card o1,card o2)
        {
            if(o1.l!=o2.l)
                return (int)(o1.l-o2.l);
            else
                return (int)(o1.r-o2.r);
        }
    }
    static void shuffle(long a[])
    {
        List<Long> l=new ArrayList<>();
        for(int i=0;i<a.length;i++)
            l.add(a[i]);
        Collections.shuffle(l);
        for(int i=0;i<a.length;i++)
            a[i]=l.get(i);
    }

    /*static long gcd(long a,long b)
    {
    if(b==0)
    return a;
    else
    return gcd(b,a%b);
    }
    static int ans1=Integer.MAX_VALUE,ans2=Integer.MAX_VALUE,ans3=Integer.MAX_VALUE,ans4=Integer.MAX_VALUE;
    static boolean v[]=new boolean[101];
    static void dfs(Integer so,Set<Integer> s[]){
    if(!v[so.intValue()])
    {
    v[so]=true;
    for(Integer h:s[so.intValue()])
    {
    if(!v[h.intValue()])
    dfs(h,s);
    }
    }
    }
    static class Print{
    public PrintWriter out;
    Print(OutputStream o)
    {
    out=new PrintWriter(o);
    }
    }
    static int CeilIndex(int A[], int l, int r, int key)
    {
    while (r - l > 1) {
    int m = l + (r - l) / 2;
    if (A[m] >= key)
    r = m;
    else
    l = m;
    }

    return r;
    }

    static int LongestIncreasingSubsequenceLength(int A[], int size)
    {
    // Add boundary case, when array size is one
    int[] tailTable = new int[size];
    int len; // always points empty slot
    tailTable[0] = A[0];
    len = 1;
    for (int i = 1; i < size; i++) {
    if (A[i] < tailTable[0])
    // new smallest value
    tailTable[0] = A[i];

    else if (A[i] > tailTable[len - 1])
    // A[i] wants to extend largest subsequence
    tailTable[len++] = A[i];

    else
    // A[i] wants to be current end candidate of an existing
    // subsequence. It will replace ceil value in tailTable
    tailTable[CeilIndex(tailTable, -1, len - 1, A[i])] = A[i];
    }
    return len;
    }*/
    /*static int binary(int n)
    {
    int s=1;
    while(n>0)
    {
    s=s<<1;
    n--;
    }
    return s-1;
    }
    static StringBuilder bin(int i,int n)
    {
    StringBuilder s=new StringBuilder();
    while(i>0)
    {
    s.append(i%2);
    i=i/2;
    }
    while(s.length()!=n)
    {
    s.append(0);
    }
    return s.reverse();
    }*/
    static boolean valid(int i,int j,int n,int m)
    {
        if(i<n && i>=0 && j<m && j>=0)
            return true;
        else
            return false;
    }

    public static void main(String[] args)
    {
        InputReader sc=new InputReader(System.in);
        int n=sc.nextInt();
        char c[]=sc.next().toCharArray();
        int c1=0,f=0;
        for(int i=0;i<n;i++)
        {
            if(c[i]=='-' && f==0)
            continue;
            else if(c[i]=='+')
            {
                c1++;
                f=1;
            }
            else if(c[i]=='-' && f==1 && c1>0)
            c1--;
            else if(c[i]=='-' && f==1 && c1==0)
            f=0;
        }
        System.out.println(c1);
    }
}

import java.io.*;
public class stones
{
 public static void main(String args[])throws IOException
 {
  InputStreamReader read=new InputStreamReader(System.in);
  BufferedReader in=new BufferedReader(read);
  int i,c,n;
  c=0;
  char p;
  String s;
  n=Integer.parseInt(in.readLine());
  s=in.readLine();
  for(i=0;i<n;i++)
  {
   p=s.charAt(i);
   if(p=='-')
   c--;
   else
   c++;
   if(c<0)
   c=0;
  }
  System.out.println(c);
 }
}

import java.sql.Array;
import java.sql.SQLOutput;
import java.util.*;
import java.io.*;
import java.math.*;

public class MyProgram {
    public static FastIO file = new FastIO();

    private static void solve() {
//        int tt = nextInt();
        int tt = 1;
        long start = 0;
        while (tt-- > 0) {
            int n = nextInt();
            String s = nextLine();
            int count = 0;
            boolean check = false;
            for (int i = 0; i < n; i++) {
                if (check && s.charAt(i) == '-') count--;
                else if (s.charAt(i) == '+') {
                    check = true;
                    count++;
                }
                if (count < 0) count = 0;
            }
            System.out.println(count);
        }
    }

    private static int[] nextArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public static int[][] nextArray2D(int n, int m) {
        int[][] result = new int[n][];
        for (int i = 0; i < n; i++) {
            result[i] = nextArray(m);
        }
        return result;
    }

    public static long pow(long n, long p) {
        long ret = 1L;
        while (p > 0) {
            if (p % 2 != 0L)
                ret *= n;
            n *= n;
            p >>= 1L;
        }
        return ret;
    }

    public static String next() {
        return file.next();
    }

    public static int nextInt() {
        return file.nextInt();
    }

    public static long nextLong() {
        return file.nextLong();
    }

    public static double nextDouble() {
        return file.nextDouble();
    }

    public static String nextLine() {
        return file.nextLine();
    }

    public static class FastIO {
        BufferedReader br;
        StringTokenizer st;
        PrintWriter out;

        public FastIO() {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }

    public static void main(String[] args) {
        solve();
    }

}

//problem: https://codeforces.com/problemset/problem/1159/A

import java.util.Scanner;
public class StonePile{
    public static void main(String[] args){
        Scanner sObj = new Scanner(System.in);
        int n = Integer.parseInt(sObj.nextLine());
        char[] cInput = sObj.nextLine().toCharArray();
        int total = 0;
        int toadd = 0;
        for(char ele: cInput){
            if(ele == '+'){
                total++;
            }
            else if(ele == '-' && total >= 1){
                total--;
            }
        }
        System.out.println(total);
    }
}

import java.io.*;
import java.util.*;

public class A {
    public static void main(String args[]) {
        FastScanner scn = new FastScanner();
        int n = scn.nextInt();
        String str = scn.nextToken();
        int c = 0;
        boolean aya = false;
        for(int i=0;i<str.length();++i){
            if(str.charAt(i) == '+'){
                aya = true;
            }
            if(aya){
                if(str.charAt(i) == '-'){
                    c--;
                } else {
                    c++;
                }
            } else {
                c = 0;
            }
            if(c<0){
                c = 0;
            }

        }
        if(c<0){
            c = 0;
        }
        System.out.println(c);
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}

//package com.algo.rishabh.arrays;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class APileOfStones {

    public static void main(String[] args) throws IOException {

        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);

        int n = Integer.parseInt(br.readLine());
        String str = br.readLine();

        int ans = 0;

        for (int i = 0; i < n; ) {
            int cntMinus = 0;
            if (str.charAt(i) == '-') {
                while (i < n && str.charAt(i) == '-') {
                    i++;
                    cntMinus++;
                }
            } else {
                while (i < n && str.charAt(i) == '+') {
                    i++;
                    ans++;
                }
            }

            if (ans < cntMinus) {
                ans = 0;
            } else {
                ans = ans - cntMinus;
            }

        }

        System.out.println(ans);

    }

}

import java.util.Scanner;
public class Piles {
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        sc.nextLine();
        String a = sc.nextLine();
        int sum = 0;
        for(int i=0;i<t;i++)
        {
            if(a.charAt(i)=='-')
            {
                if(sum<=0)
                    sum=0;
                else
                {
                    sum-=1;
                }
            }
            else if(a.charAt(i)=='+')
            {
                sum+=1;
            }
        }
        System.out.println(sum);
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		Reader in = new Reader();
		int n = in.nextInt();
		String s = in.next();
		int ans = 0;
		for(char c : s.toCharArray()) if(c=='-'&&ans>0) ans--; else if(c=='+') ans++;
		System.out.println(ans);
	}
	public static class FCP{
		long[] fact;
		public FCP(int maxn) {
			fact = new long[maxn+1];
			Arrays.fill(fact, -1);
			fact[0] = 1;
		}
		public long factorial(int x) {
			if(fact[x]!=-1) return fact[x];
			return fact[x] = (x*factorial(x-1));
		}
		public long C(int n, int k) {
			return P(n,k)/factorial(k);
		}
		public long P(int n, int k) {
			return (factorial(n)/factorial(n-k));
		}
	}
	static class Reader {
		static BufferedReader br;
		static StringTokenizer st;

		public Reader() {
			this.br = new BufferedReader(new InputStreamReader(System.in));
		}

		public int[] na(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nl(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public String[] nS(int n) {
			String[] a = new String[n];
			for (int i = 0; i < n; i++)
				a[i] = next();
			return a;
		}

		public int nextInt() {
			if (st == null || !st.hasMoreTokens())
				try {
					readLine();
				} catch (Exception e) {
				}
			return Integer.parseInt(st.nextToken());
		}

		public double nextDouble() {
			if (st == null || !st.hasMoreTokens())
				try {
					readLine();
				} catch (Exception e) {
				}
			return Double.parseDouble(st.nextToken());
		}

		public Long nextLong() {
			if (st == null || !st.hasMoreTokens())
				try {
					readLine();
				} catch (Exception e) {
				}
			return Long.parseLong(st.nextToken());
		}

		public String next() {
			if (st == null || !st.hasMoreTokens())
				try {
					readLine();
				} catch (Exception e) {
				}
			return st.nextToken();
		}

		public static void readLine() {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
			}
		}
	}
}

import java.util.*;
public class Problem559A {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		String input = in.next();

		int count = 0;
		int max = 0;
		for(int i = 0;i<n;i++){
			char op = input.charAt(i);
			if(op == '-'){
				count--;
				if(count < 0){
					count = 0;
				}
			}else{
				count++;
			}
		}
		if(count > 0){
			System.out.println(count);
		}else{
			System.out.println(0);
		}

	}

}

import java.util.*;
public class Main {
    public static void main(String args[]) {
      int n,i,c=0,h=0;
      Scanner sc=new Scanner(System.in);
      n=sc.nextInt();
      String a=sc.next();
      for(i=0;i<a.length();i++)
      {
          if(a.charAt(i)=='+')
          c++;
          else
          c--;
          if(c<0)
          c++;
      }
      if(c<0)
      System.out.println("0");
      else
      System.out.println(c);
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package newpackage;
import java.util.*;
/**
 *
 * @author parpaorsa
 */
public class NewClass {
    static Scanner in=new Scanner(System.in);
    public static void main(String[] args) {
        int n = in.nextInt(),ans=Integer.MAX_VALUE,t=0;
        String x = in.next();
        for (int i = 0; i < n; i++) {
            if(x.charAt(i)=='-')t--;
            else t++;
            ans=Math.min(ans,t);
        }
           if(ans <= 0)
               System.out.println(Math.abs(ans)+t);
           else
               System.out.println(t);
    }

}

import java.util.*;
public class pile
{
    public static void main(String[]args)
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();int c=0,i=0;
        String s=sc.next();
        for(i=0;i<n;i++)
        {
          if(s.charAt(i)=='+')
          c++;
          else
          c--;
          if(c<0)
          c++;
        }
        System.out.println(c);
    }
}

import java.util.Scanner;

public class Main {
	private static Scanner sc;
	public static void main(String [] args) {

		sc = new Scanner(System.in);

		int n = sc.nextInt();
		String s = sc.next();

		int i = 0;
		int r = 0;
		while(i < n && s.charAt(i) == '-') {
			i++;
			r++;
		}

		for(i = 0; i<n ; i++)
			if(s.charAt(i) == '+')
				r++;
			else {
				if(r == 0 )
					r++;
				r--;
			}
		System.out.print(r);
	}
}

import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner s=new Scanner(System.in);
    int n = s.nextInt();
    String p = s.next();
    int m=0,o=0;
    for(int i=0;i<n;i++)
    {
      if(p.charAt(i)=='+')
      m++;
      else
      m--;
      if(m<0)
      o=Math.max(o,-m);
    }
    System.out.println(o+m);
  }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        int output = 0;
        String operations = scanner.nextLine();
        for (char op: operations.toCharArray()) {
            if (op == '+') {
                output++;
            } else if (op == '-'){
                if (output != 0) {
                    output--;
                }
            }
        }
        if (output > 0) {
            System.out.println(output);
        } else {
            System.out.println(0);
        }
    }
}

import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int res = 0;
        int pos = 0;
        int neg = 0;
        boolean valid = false;
        for(int i=0; i<s.length(); i++) {
            if(s.charAt(i) == '+')
                res++;
            else
                res--;
            if(res < 0)
                res++;
        }
        System.out.println(res);
    }
}

import java.util.Scanner;

public class Main{
public static void main(String args[]){
	Scanner in=new Scanner(System.in);
	int n=in.nextInt();
	in.nextLine();
	String s=in.nextLine();
	int add =0;
	for(int i=0;i<n;i++){
	if(s.charAt(i) =='-'){
		if(add > 0)
			add--;
    }
    else{
	    add++;
    }
    }
    System.out.println(add);
}
}

import java.util.*;
import java.io.*;
public class Solution{

	public static void main(String args[])throws IOException{

		Scanner in=new Scanner(System.in);

		int n=in.nextInt();

		String action=in.next();

		int count=0;

		for(int i=0; i<n; i++){

			if(action.charAt(i)=='-')
				count-=1;
			else count+=1;

			if(count<0)
				count=0;
		}

		System.out.println(count);
	}
}

import java.util.Scanner;

public class Main1159A {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    while (in.hasNext()) {
      int n = in.nextInt();
      String s = in.next().substring(0, n);
      int stone = 0;
      for (int i = 0; i < n; i++) {
        if (s.charAt(i) == '-') {
          stone++;
        } else {
          break;
        }
      }
      char[] ch = s.toCharArray();
      for (char c : ch) {
        if (c == '-' && stone > 0) {
          stone--;
        } else if (c == '+') {
          stone++;
        }
      }
      System.out.println(stone);
    }
    in.close();
  }
}
/*
 * +-+-+-++--++-++-+-+---+--++++++-++++--++-++---+--++++--+++++++-++-+--+-+-+--+
 * -+++++-+--+---+-++-++-+
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class codeforces{
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder str=new StringBuilder();
        int t=Integer.parseInt(br.readLine());
        String a=br.readLine();
        int min=Integer.MAX_VALUE,sum=0;
        for(int i=0;i<t;i++){
            if(a.charAt(i)=='+')
            sum++;
            else
            sum--;
            min=Math.min(sum,min);
        }
        if(min>=0)
        str.append(sum);
        else{
            str.append(sum-min);
        }
        System.out.println(str);
    }
}

import java.util.*;
public class Stones
{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String st=sc.next();
        int nm=0,np=0,in=0;
        int sum=0,k=0;

        for(int i=0;i<st.length();i++)
        {
            if(st.charAt(i)=='+')
            np+=1;
            else
            nm+=1;
        }
      //  System.out.println("nm "+nm+" np "+np);
        if(nm==0)
        {
            sum=sum+np;
        }
         if(np==0)
        {
            sum=0;

        }
        if(np>=nm)
        {
            in=st.indexOf('+');
            k=1;
        }
        if(nm>np)
        {
            in=nm-np;
            k=1;
        }

        if(k==1)
        {
            sum=in;
           // System.out.println("YOO "+in);

            for(int i=0;i<st.length();i++)
            {
                //if(i==0)
            //System.out.println("YOLA");
         //       System.out.println(i);
                if(st.charAt(i)=='-')
                sum=sum-1;
                else
                sum=sum+1;

                if(sum<0){
                in=in+1;
                sum=in;
               // System.out.println("YOO "+in);
                i=-1;}
            }
        }
        System.out.println(sum);
        }
}

import java.io.*;
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long x = in.nextLong();
        String s = in.next();
        long plus = 0;
        int i = 0;
        while(i<x && s.charAt(i)=='-'){
            i++;
        }
        for(;i<x;i++){
            if (s.charAt(i)=='-'){
                if (plus>0){
                    plus--;
                }
            }else{
                plus++;
            }
        }
        System.out.println(plus);
    }
}

import java.io.*;
import java.util.*;

public class VirtualA {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastScanner s = new FastScanner();
		int n = s.nextInt();
		char[] arr = s.nextString().toCharArray();
		int p = 0,m=0;
		for(char x: arr)
			if(x=='+')p++;
			else m++;
		int ans = 0;
		if(m>=p) {
			ans = m-p;
		}
		int st =0 ;ans = 0;
		for(int i = 0;i<n;i++)
		{
			if(arr[i]=='-')ans--;
			else ans++;

			if(ans<0) {st++;ans++;}

		}
		ans = st;
		for(int i = 0;i<n;i++)
		{
			if(arr[i]=='-')ans--;
			else ans++;

			if(ans<0)st++;

		}
		System.out.println(ans);

	}
static   class FastScanner {

	    private InputStream mIs;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner() {
			this(System.in);
		}

		public FastScanner(InputStream is) {
			mIs = is;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = mIs.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;

		}

	}

}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class brend {
    FastScanner in;
    PrintWriter out;
    boolean systemIO = true;
    Integer INF = Integer.MAX_VALUE / 2;

    void solve() {
        int n = in.nextInt();
        String x = in.next();
        for (int i = 0; i <= 100; i++) {
            int ans = i;
            boolean k = true;
            for (int j = 0; j < x.length(); j++) {
                ans += (x.charAt(j) == '-') ? (-1) : 1;
                if(ans<0){
                    k = false;
                    break;
                }
            }
            if(k){
                System.out.println(ans);
                break;
            }
        }

    }

    private void run() throws IOException {
        if (systemIO) {
            in = new brend.FastScanner(System.in);
            out = new PrintWriter(System.out);
        } else {
            in = new brend.FastScanner(new File("h.in"));
            out = new PrintWriter(new File("h.out"));
        }
        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

    }

    public static void main(String[] arg) throws IOException {
        new brend().run();
    }

}

import java.util.*;
import java.io.*;
public class A {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        int res = 0;
        int n = Integer.parseInt(f.readLine());
        String in = f.readLine();

        for (int i = 0; i < n; i++) {
            if(in.charAt(i) == '+') res++;
            else res--;
            if(res < 0) res++;
        }

        System.out.println(res);
    }
}

/******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/
import java.util.*;
public class Main
{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int tst=sc.nextInt();
		String str=sc.next();
		char ch[]=str.toCharArray();
		int count=0;
		int i=0;
		while(ch[i]=='-')
		{
		    count++;
		    i++;
		    if(i==ch.length)
		    break;
		}
		for(int j=0;j<ch.length;j++)
		{
		   if(ch[j]=='-')
		   {
		   if(count==0)
		   continue;
		   else
		   count--;
		   }
		   else
		   count++;
		}
		System.out.println(count);
	}
}

import java.util.Scanner;

public class Solution {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        solve();
    }

    private static void solve() {
        int n = sc.nextInt();
        String s = sc.next();
        char [] arr = s.toCharArray();
        int ans = 0;
        for(int i=0; i<n; i++) {
            if(arr[i] == '+') ans++;
            else ans--;
            if(ans<0) ans = 0;
        }

        System.out.println(ans);
    }
}

import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Solution {

    // Complete the maximumSum function below

    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) throws IOException {
     int test=scanner.nextInt();
    String x=scanner.next();
    int sum=0;
    for(int i=0;i<x.length();i++){
        if(x.charAt(i)=='+'){
            sum+=1;
        }
        else {
            if(sum-1>=0){
                sum-=1;
            }
        }
    }
    System.out.println(sum);
    }
}

import java.util.*;import java.io.*;import java.math.*;

public class Main
{

    public static void process()throws IOException
    {
        int n=ni();
        char arr[]=(" "+nln()).toCharArray();

        int p=0,m=0;
        Stack<Character> stack = new Stack<>();

        for(int i=1;i<=n;i++){
            if(arr[i]=='+')
                stack.push(arr[i]);
            else{

                if(stack.isEmpty())
                    continue;
                else
                    stack.pop();
            }
        }
        pn(stack.size());
    }

       static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

        oj = System.getProperty("ONLINE_JUDGE") != null;
        if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner s=new Scanner(System.in);
    int n = s.nextInt();
    String p = s.next();
    int m=0,o=0;
    for(int i=0;i<n;i++)
    {
      if(p.charAt(i)=='+')
      m++;
      else
      m--;
      if(m<0)
      o=Math.max(o,-m);
    }
    System.out.println(o+m);
  }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Bisoye
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AAPileOfStones solver = new AAPileOfStones();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAPileOfStones {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = Integer.parseInt(in.next());
            String str = in.next();

            int count = 0;

            for (int i = 0; i < n; i++) {
                count += str.charAt(i) == '+' ? 1 : -1;
                count = Math.max(0, count);
            }
            out.println(count);

        }

    }
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String s = scan.next();
        System.out.println(result(n, s));
    }

    private static int result(int n, String s) {
        int cnt = 0;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c=='-') cnt--;
            else cnt++;
            if(cnt<0) cnt++;
        }
        return cnt;
    }
}

import java.util.*;
public class stone
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int m,count=0;
        String s;
        m=sc.nextInt();
        s=sc.next();
        for(int i=0;i<m;i++)
        {
            if(s.charAt(i)=='-') count--;
            if(count<0) count=0;
            if(s.charAt(i)=='+') count++;
        }
        System.out.println(count);
        sc.close();
    }
}

import java.io.*;
import java.util.*;

public class cf
{
    public static void main(String[] args)
    {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        String s=in.nextLine();
        s=in.nextLine();int min=0;
        for(int i=0;i<n;i++)
            if(s.charAt(i)=='+')
                min++;
            else
            {
                min--;
                min=Math.max(min,0);
            }
        System.out.println(min);
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner e = new Scanner(System.in);

		int n = e.nextInt();
		String line = e.next();

		int p = 0, m = 0;
		for(int i = 0; i < n; i++)
		{
			if(line.charAt(i) == '+')
				p++;
			else
			{
				if(p == 0)
					continue;
				else
					p--;
			}
		}

		if(p <= 0)
			System.out.println("0");
		else
			System.out.println(p);

	}
}

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {
 public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        in.nextLine();
        String str=in.nextLine();
        int np=0,nm=0;
        for(int i=0;i<n;i++){
            if(str.charAt(i)=='+')np++;
            else nm++;
        }
        if(np==n){
            System.out.println(n);
            return;
        }
        if(nm==n){
            System.out.println(0);
            return;
        }
        int cnt=str.charAt(0)=='-'?1:0;
        for(int i=0;i<n;i++){
            if(str.charAt(i)=='+')cnt++;
            else if(cnt!=0) cnt--;
        }
        System.out.println(cnt);

   }
   static class Pair implements Comparable<Pair>{
        int x;
        int y;
        Pair(int a,int b){
            x=a;
            y=b;
        }
        @Override
        public int compareTo(Pair t){
            if(x>t.x)return 1;
            else if(x==t.x){
                if(y>=t.y)return 1;
                else return -1;
            }
            else return -1;
        }
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        String s = scan.next();

        int x=0;
        for(int i=0;i<n;i++){
            if(s.charAt(i)=='+'){
                x++;
            }
            else{
                x--;
                if(x<0){
                    x=0;
                }
            }
        }
        System.out.println(x);
    }
}

import java.io.*;
import java.util.*;

public class codeforces {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        char s[] = scan.next().toCharArray();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (s[i] == '+') ans++;
            else {
                ans--;
                ans = Math.max(0, ans);
            }
        }
        System.out.println(ans);
    }
}

import java.io.*;
import java.util.*;

public class Main {
	static InputReader scn = new InputReader(System.in);
	static OutputWriter out = new OutputWriter(System.out);

	public static void main(String[] args) {
		int t = 1;
		while (t-- > 0)
			solve();
		out.close();
	}

	public static void solve() {
		int n = scn.nextInt();
		String s = scn.next();
		int ans = 0;
		for (int i = 0; i < n; i++) {
			char ch = s.charAt(i);
			if (ch == '-') {
				if (ans != 0)
					ans--;
			} else {
				ans++;
			}
		}
		out.println(ans);
	}

	public static boolean checkAB(String s) {
		int n = s.length();
		for (int i = 0; i < n - 1; i++) {
			char ch = s.charAt(i);
			;
			char ch1 = s.charAt(i + 1);
			if (ch == 'A' && ch1 == 'B')
				return true;
		}
		return false;
	}

	public static boolean checkBB(String s) {
		int n = s.length();
		for (int i = 0; i < n - 1; i++) {
			char ch = s.charAt(i);
			;
			char ch1 = s.charAt(i + 1);
			if (ch == 'B' && ch1 == 'B')
				return true;
		}
		return false;
	}

	public static boolean check(int[] arr) {
		int sum = 0;
		for (int i : arr) {
			sum += i;
			if (sum == 0)
				return true;
		}
		return false;
	}

	public static int firstOccurence1(int array1[], int low, int high, int x, int n) {
		if (low <= high) {
			int mid = low + (high - low) / 2;
			if ((mid == 0 || x > array1[mid - 1]) && array1[mid] == x)
				return mid;
			else if (x > array1[mid])
				return firstOccurence(array1, (mid + 1), high, x, n);
			else
				return firstOccurence(array1, low, (mid - 1), x, n);
		}
		return -1;
	}

	public static HashMap<Integer, Integer> CountFrequencies(int[] arr) {
		HashMap<Integer, Integer> map = new HashMap<>();
		for (int i = 0; i < arr.length; i++) {
			int a = arr[i];
			if (map.containsKey(a)) {
				map.put(a, map.get(a) + 1);
			} else {
				map.put(a, 1);
			}
		}
		return map;
	}

	public static int max(int a, int b) {
		if (a >= b)
			return a;
		return b;
	}

	public static int min(int a, int b) {
		if (a <= b)
			return a;
		return b;
	}

	public static long gcd(long a, long b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}

	public static int lcm(int a, int b) {
		return (a * b) / gcd(a, b);
	}

	public static int gcd(int a, int b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}

	public static boolean isPrime(long n) {
		if (n < 2)
			return false;
		if (n == 2 || n == 3)
			return true;
		if (n % 2 == 0 || n % 3 == 0)
			return false;
		long sqrtN = (long) Math.sqrt(n) + 1;
		for (long i = 6L; i <= sqrtN; i += 6) {
			if (n % (i - 1) == 0 || n % (i) + 1 == 0)
				return false;
		}
		return true;
	}

	public static int[] SieveOfEratosthenes(int[] arr) {
		int n = arr.length;
		for (long i = 3; i < n; i = i + 2) {
			arr[(int) i] = 1;
		}
		for (long i = 3; i < n; i = i + 2) {
			if (arr[(int) i] == 1) {
				for (long j = (long) i * i; j < n; j = j + i) {
					arr[(int) j] = 0;
				}
			}
		}
		arr[2] = 1;
		arr[0] = arr[1] = 0;
		return arr;
	}

	static void sort(int[] a) {
		ArrayList<Integer> l = new ArrayList<>();
		for (int i : a) {
			l.add(i);
		}
		Collections.sort(l);
		for (int i = 0; i < a.length; i++) {
			a[i] = l.get(i);
		}
	}

	public static ArrayList<String> printPermutn(String str, String ans, ArrayList<String> list) {
		if (str.length() == 0) {
			list.add(ans);
		}
		for (int i = 0; i < str.length(); i++) {
			char ch = str.charAt(i);
			String ros = str.substring(0, i) + str.substring(i + 1);
			printPermutn(ros, ans + ch, list);
		}
		return list;
	}

	public static int binarySearch(int arr[], int l, int r, int x) {
		if (r >= l) {
			int mid = l + (r - l) / 2;
			if (arr[mid] == x)
				return mid;
			if (arr[mid] > x)
				return binarySearch(arr, l, mid - 1, x);
			return binarySearch(arr, mid + 1, r, x);
		}
		return -1;
	}

	public static int firstOccurence(int array1[], int low, int high, int x, int n) {
		if (low <= high) {
			int mid = low + (high - low) / 2;
			if ((mid == 0 || x > array1[mid - 1]) && array1[mid] == x)
				return mid;
			else if (x > array1[mid])
				return firstOccurence(array1, (mid + 1), high, x, n);
			else
				return firstOccurence(array1, low, (mid - 1), x, n);
		}
		return -1;
	}

	public static int lastOccurence(int array2[], int low, int high, int x, int n) {
		if (low <= high) {
			int mid = low + (high - low) / 2;
			if ((mid == n - 1 || x < array2[mid + 1]) && array2[mid] == x)
				return mid;
			else if (x < array2[mid])
				return lastOccurence(array2, low, (mid - 1), x, n);
			else
				return lastOccurence(array2, (mid + 1), high, x, n);
		}
		return -1;
	}

	static final Random random = new Random();

	static void ruffleSort(int[] a) {
		int n = a.length;// shuffle, then sort
		for (int i = 0; i < n; i++) {
			int oi = random.nextInt(n), temp = a[oi];
			a[oi] = a[i];
			a[i] = temp;
		}
		Arrays.sort(a);
	}

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int[] readArrays(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = scn.nextInt();
			}
			return arr;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return nextLine();
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

	static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0) {
					writer.print(' ');
					// writer.print(1);
				}
				writer.print(objects[i]);
			}
		}

		public void println(Object... objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}
	}

}

import java.util.*;
public class Problem559A {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		String input = in.next();

		int count = 0;
		int max = 0;
		for(int i = 0;i<n;i++){
			char op = input.charAt(i);
			if(op == '-'){
				count--;
				if(count < 0){
					count = 0;
				}
			}else{
				count++;
			}
		}
		if(count > 0){
			System.out.println(count);
		}else{
			System.out.println(0);
		}

	}

}

import java.io.*;

public class Pile_of_stones {
    private static class Reader
    {
        private byte buffer[];
        private DataInputStream din;
        private final int size = 1<<16;
        private int bufferpointer,bytesRead;
        public Reader(){
            din = new DataInputStream(System.in);
            bufferpointer=bytesRead=0;
            buffer = new byte[size];
        }
        public String readLine()throws IOException
        {
            byte b[] = new byte[1000];
            int cnt=0,c;
            while((c=scan())!=-1)
            {
                if(c=='\n')
                    break;
                b[cnt++] = (byte)c;
            }
            return new String(b,0,cnt);
        }
        public int nextInt()throws IOException
        {
            int num=0,c=scan();
            boolean neg = false;
            while(c<=' ')
                c = scan();
            if(c=='-')
            {
                neg=true;
                c = scan();
            }
            do
            {
                num = num*10+c-'0';
                c = scan();
            }
            while(c<='9'&&c>='0');
            if(neg)
                return -1*num;
            else
                return num;
        }
        public long nextLong()throws IOException
        {
            long num=0,c=scan();
            boolean neg = false;
            while(c<=' ')
                c = scan();
            if(c=='-')
            {
                neg=true;
                c = scan();
            }
            do
            {
                num = num*10+c-'0';
                c = scan();
            }
            while(c<='9'&&c>='0');
            if(neg)
                return -1*num;
            else
                return num;
        }
        private byte scan()throws IOException
        {
            if(bufferpointer>=bytesRead) {
                fillBuffer();
            }
            return buffer[bufferpointer++];
        }
        private void fillBuffer()throws IOException
        {
            bytesRead = din.read(buffer, bufferpointer=0, size);
            if(bytesRead==-1)
                buffer[0] = -1;
        }
    }
    private static class Writer
    {
        private final PrintWriter p;
        public Writer(OutputStream o)
        {
            p = new PrintWriter(new BufferedWriter(new OutputStreamWriter(o)));
        }
        public void print(Object... o1)
        {
            for (Object o11 : o1) {
                p.print(o11);
            }
        }
        public void print(String s)
        {
            p.print(s);
        }
        public void println(Object... o1)
        {
            print(o1);
            p.println();
        }
        public void flush()
        {
            p.flush();
        }
        public void close()
        {
            p.close();
        }
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String s = br.readLine();
        int p=0;
        for (int i = 0; i < n; i++) {
            if(s.charAt(i)=='-')
            {
                if(p==0)
                    p=1;
                p--;
            }
            else
                p++;
        }
        System.out.println(p);
    }
}

/*
Problem Name: A pile of stones
URL: http://m1.codeforces.com/contest/1159/problem/A
*/

import java.util.*;

public class A_pile_of_stones{
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		String enter = sc.nextLine();

		String s1 = sc.nextLine();

		int sum = 0;

		int minusCount = 0;

		boolean flag = false;

		for(int i = 0; i<n; i++){

			if(s1.charAt(i)=='+'){
				sum++;
				flag = true;
			}else if(flag && s1.charAt(i)=='-'){
				sum--;
				if(sum<0){
					sum=0;
				}
			}

		}

		System.out.println(sum);

	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.DataInputStream;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author complexgene
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Reader in = new Reader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        AAPileOfStones solver = new AAPileOfStones();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAPileOfStones {
        public void solve(int testNumber, Reader in, OutputWriter out) {
            int n = in.ni();
            char[] s = in.next().toCharArray();
            int res = 0;
            for (int i = 0; i < n; i++) {
                if (s[i] == '+') {
                    res++;
                } else {
                    res--;
                    if (res < 0) res = 0;
                }
            }
            out.printLine(res);
        }

    }

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer;
        private int bytesRead;

        public Reader() {
            this(System.in);
        }

        public Reader(InputStream in) {
            din = new DataInputStream(in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public int ni() {
            int ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg) {
                c = read();
            }
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg) {
                return -ret;
            }
            return ret;
        }

        private void fillBuffer() {
            try {
                bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
                if (bytesRead == -1) {
                    buffer[0] = -1;
                }
            } catch (IOException ioe) {
            }
        }

        private byte read() {
            if (bufferPointer == bytesRead) {
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

        public String next() {
            int c;
            for (c = read(); c <= 32; c = read()) ;
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = read())
                sb.append((char) c);
            return sb.toString();
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter() {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        }

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
            writer.flush();
        }

        public void printLine(Object... object) {
            print(object);
            writer.println();
            writer.flush();
        }

        public void close() {
            writer.close();
        }

    }
}

import java.util.Scanner;
public class a{
    public static void main(String args[]){
        Scanner s = new Scanner(System.in);
        int len = s.nextInt();
        int count = 0;
        char c[]= s.next().toCharArray();
        int idx = 0;
        if(c[idx]=='-'){
            while(idx<c.length && c[idx]=='-')
                idx++;
        }
        for(int i=idx;i<c.length;i++){
            if(c[i]=='+')count++;
            else count--;
            if(count<0) count=0;
        }
        System.out.println(count);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ky112233
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AAPileOfStones solver = new AAPileOfStones();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAPileOfStones {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            String str = in.next();
            int val = 0;
            int mn = Integer.MAX_VALUE;
            for (int i = 0; i < n; i++) {
                if (str.charAt(i) == '-') val--;
                else val++;
                mn = Math.min(mn, val);
            }
            if (mn < 0) {
                out.println(val + Math.abs(mn));
            } else {
                out.println(val);
            }
        }

    }
}

import java.io.*;
import java.util.*;

/******************************\
 * The solution is at the top *
 *                            *
 *   Created by : azhar556    *
\******************************/

public class Solution {
    static void solve() {
        int n = ni();
        String s = ns();
        int res = 0;
        boolean start = false;
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == '+') {
                start = true;
            }
            if (start) {
                if (s.charAt(i) == '+') {
                    res++;
                }
                else {
                    res--;
                    res = Math.max(res, 0);
                }
            }
        }
        out.println(res);
    }

    public static void main(String[] args) {
        long time = System.currentTimeMillis();
        int t;// = ni();
        t = 1;
        while (t-- > 0) solve();
        err.println("Time elapsed : " + (System.currentTimeMillis() - time) / 1000F + " s.");
        err.close(); out.close();
    }

    static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    static PrintWriter err = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.err)));
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer token;

    static String ns() {
        while (token == null || !token.hasMoreTokens()) {
            try {
                token = new StringTokenizer(br.readLine());
            }
            catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return token.nextToken();
    }
    static char nc() {
        return Character.valueOf(ns().charAt(0));
    }
    static int ni() {
        return Integer.parseInt(ns());
    }
    static double nd() {
        return Double.parseDouble(ns());
    }
    static long nl() {
        return Long.parseLong(ns());
    }
}

import java.util.*;

public class codetwo {
		public static void main(String[] args) {
			Scanner sc=new Scanner(System.in);
			int n=sc.nextInt();
			int count=0;
			String seq=sc.next();
			for(int i=0;i<seq.length();i++) {
				if(seq.charAt(i)=='+'){
					count++;
				}
				if(seq.charAt(i)==('-')) {
					if(count==0) {
						count++;
					}
					count--;
				}
			}
			System.out.println(count);
		}
}

import java.util.Scanner;

public class Solution {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        solve();
    }

    private static void solve() {
        int n = sc.nextInt();
        String s = sc.next();
        char [] arr = s.toCharArray();
        int ans = 0;
        for(int i=0; i<n; i++) {
            if(arr[i] == '+') ans++;
            else ans--;
            if(ans<0) ans = 0;
        }

        System.out.println(ans);
    }
}

/******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/
import java.util.*;
public class Main
{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int tst=sc.nextInt();
		String str=sc.next();
		char ch[]=str.toCharArray();
		int count=0;
		int i=0;
		while(ch[i]=='-')
		{
		    count++;
		    i++;
		    if(i==ch.length)
		    break;
		}
		for(int j=0;j<ch.length;j++)
		{
		   if(ch[j]=='-')
		   {
		   if(count==0)
		   continue;
		   else
		   count--;
		   }
		   else
		   count++;
		}
		System.out.println(count);
	}
}

	import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.io.PrintWriter;
	import java.math.BigInteger;
	import java.util.*;

	public class usd {

		static int r=0;static int c=0;
		static void fillzero(int a[][],int n)
		{
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<n-1;j++)
				{
					if(a[j][i]==0&&a[j+1][i]==0)
					{
						a[j][i]=1;a[j+1][i]=1;
						r=j;c=i;
						return;
					}
				}
			}
		}
		static void fillone(int a[][],int n)
		{
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<n-1;j++)
				{
					if(a[i][j]==0&&a[i][j+1]==0)
					{
						a[i][j]=1;a[i][j+1]=1;
						r=i;c=j;
						return;
					}
				}
			}
		}

		static void check(int a[][],int n)
		{
			for(int i=0;i<4;i++)
			{
				if(a[i][0]==1&&a[i][1]==1&&a[i][2]==1&&a[i][3]==1)
				{
					a[i][0]=0;a[i][1]=0;a[i][2]=0;a[i][3]=0;
				}
			}
			for(int i=0;i<4;i++)
			{
				if(a[0][i]==1&&a[1][i]==1&&a[2][i]==1&&a[3][i]==1)
				{
					a[0][i]=0;a[1][i]=0;a[2][i]=0;a[3][i]=0;;
				}
			}
		}

		public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner in=new Scanner (System.in);
		TreeMap<Integer,Integer>map=new TreeMap<Integer,Integer>();
		ArrayList<Integer>st1=new ArrayList<Integer>();
		ArrayList<Integer>st2222=new ArrayList<Integer>();
		Stack<Integer>st12=new Stack<Integer>();
		Stack<Integer>st2=new Stack<Integer>();
		int n=in.nextInt();
	String s=in.next();int ct=0;
	for(int i=0;i<s.length();i++)
	{
		if(s.charAt(i)=='+')
		{
			ct++;
		}
		else if(ct>0)
			ct--;
	}
		System.out.println(ct);

		}

	}

import java.util.*;

public class helloWorld
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		String str = in.next();
		int ans = 0;

		for(int i = 0; i < n; i++)
			if(str.charAt(i) == '+')
				ans++;
			else
				ans = Math.max(0, ans-1);

		System.out.println(ans);

		in.close();
	}
}

import java.util.*;
public class pile
{
    public static void main(String[]args)
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();int c=0,i=0;
        String s=sc.next();
        for(i=0;i<n;i++)
        {
          if(s.charAt(i)=='+')
          c++;
          else
          c--;
          if(c<0)
          c++;
        }
        System.out.println(c);
    }
}

import java.util.Scanner;

public class A1159 {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		int cnt1=0;
		for(int i=0;i<n;i++)
		{
			if(s.charAt(i)=='+')
			{
				cnt1++;
				//cnt=0;
			}
			else
			{
				if(cnt1==0);
				else
				cnt1--;
				//cnt2++;
			}
		}

			System.out.println(cnt1);

	}
}

import java.util.*;
import java.util.Arrays;
import java.util.Scanner;
import java.util.ArrayList;
public class STASK {

	public static void main(String[] args) {
	  // TODO Auto-generated method stub
        Scanner Input=new Scanner(System.in);
        int n =Input.nextInt();
        int c=0,x=0,z=0;
        //Input=new Scanner(System.in);
        String s=Input.next();
        for(int i=0;i<n;i++)
        {
          if(s.charAt(i)=='+')c++;
          else x++;
        }
        if(x>0&&c==0)
        	System.out.println(0);
        else if(c==x)
        	System.out.println(c);
        else if(x>0&&c>0)
        {
           for(int j=0;j<n;j++) {
              if(s.charAt(j)=='-')z++;
              else break;
         }
        System.out.println(Math.abs((c-x)+z));
       }
       else if(x==0&&c>0)
        	System.out.println(c);
    }
}

import java.util.Scanner;
public class a{
    public static void main(String args[]){
        Scanner s = new Scanner(System.in);
        int len = s.nextInt();
        int count = 0;
        char c[]= s.next().toCharArray();
        int idx = 0;
        if(c[idx]=='-'){
            while(idx<c.length && c[idx]=='-')
                idx++;
        }
        for(int i=idx;i<c.length;i++){
            if(c[i]=='+')count++;
            else count--;
        }
        count = (count<0) ? 0 : count;
        System.out.println(count);
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int output = 0;
        String operations = scanner.nextLine();
        for (char op: operations.toCharArray()) {
            if (op == '+') {
                output++;
            } else {
                output--;
            }
        }
        if (output > 0) {
            System.out.println(output);
        } else {
            System.out.println(0);
        }
    }
}

import java.util.Scanner;

public class Main {
	private static Scanner sc;
	public static void main(String [] args) {

		sc = new Scanner(System.in);

		int n = sc.nextInt();
		String s = sc.next();

		int i = 0;

		while(i < n && s.charAt(i) == '-')
			i++;

		int r = 0;
		for(; i<n ; i++)
			if(s.charAt(i) == '+')
				r++;
			else
				r--;
		System.out.print(r);
	}
}

import java.util.Scanner;

public class A {

    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        scn.nextLine();
        String op = scn.nextLine();
        scn.close();
        int init = 0;
        int sum = 0;
        for (int i = 0; i < n; i++) {
            if (op.charAt(i) == '-') {
                sum--;
                if (sum < 0) init++;
            } else {
                sum++;
            }
        }
        int res = init + sum;
        System.out.println(res);
    }

}

import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class A{
public static long mod = 1000000007;
public static int dx[] = {-1,0,1,0,-1,-1,1,1,-1};//primero ady, despues esq
public static int dy[] = {0,1,0,-1,1,1,-1,-1};
public static void main(String args[]) throws IOException{
StringBuilder sb = new StringBuilder("");
BufferedReader lector = new BufferedReader(new InputStreamReader(System.in));
//String tmp[] = lector.readLine().split(" ");
int cas = Integer.parseInt(lector.readLine());
String b =  lector.readLine();
int a = 0;
for(int n = 0;n<b.length();n++)
a+=b.charAt(n)=='+'?1:-1;
int n = 0;
while(n<b.length() &&b.charAt(n)=='-'){
a++;
n++;
}
System.out.println(a);
}

}
class p implements Comparable{
public int a;
public p(int a){
this.a = a;
}
public String toString(){
return "";
}
public int compareTo(Object o){
p pp = (p)o;
return (int)Math.signum(a-pp.a);
}
}
//sergio1

import java.io.*;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class e
{
    public static void print(String str,int val){
        System.out.println(str+"  "+val);
    }

    public long gcd(long a, long b) {
        if (b==0L) return a;
        return gcd(b,a%b);
    }

    public static void debug(long[][] arr){
        int len = arr.length;
        for(int i=0;i<len;i++){
            System.out.println(Arrays.toString(arr[i]));
        }
    }
    public static void debug(int[][] arr){
        int len = arr.length;
        for(int i=0;i<len;i++){
            System.out.println(Arrays.toString(arr[i]));
        }
    }
    public static void debug(String[] arr){
        int len = arr.length;
        for(int i=0;i<len;i++){
            System.out.println(arr[i]);
        }
    }

    public static void print(int[] arr){
        int len = arr.length;
        for(int i=0;i<len;i++){
            System.out.print(arr[i]+" ");
        }
        System.out.print('\n');
    }
    public static void print(String[] arr){
        int len = arr.length;
        for(int i=0;i<len;i++){
            System.out.print(arr[i]+" ");
        }
        System.out.print('\n');
    }
    public static void print(long[] arr){
        int len = arr.length;
        for(int i=0;i<len;i++){
            System.out.print(arr[i]+" ");
        }
        System.out.print('\n');
    }

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }
        public FastReader(String path) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(path));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args)
    {
        FastReader s=new FastReader();
        int n = s.nextInt();
        String str = s.nextLine();
        int idx =0;
        while (idx<n && str.charAt(idx)=='-'){
            idx++;
        }
        int cnt =0;
        for(int i=idx;i<n;i++){
            if(str.charAt(i)=='+'){
                idx++;
            }
            else {
                idx--;
            }
        }
        System.out.println(Math.max(idx, 0));

    }

//    OutputStream out = new BufferedOutputStream( System.out );
//        for(int i=1;i<n;i++){
//              out.write((arr[i]+" ").getBytes());
//         }
//        out.flush();
//  long start_time = System.currentTimeMillis();
//  long end_time = System.currentTimeMillis();
//  System.out.println((end_time - start_time) + "ms");

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int output = 0;
        String operations = scanner.nextLine();
        int i = 0;
        boolean found = false;
        for (char op: operations.toCharArray()) {
            if (op == '+') {
                output++;
                found = true;
            } else if (op == '-'){
                if (found == true) {
                    output--;
                }
            }
        }
        if (output > 0) {
            System.out.println(output);
        } else {
            System.out.println(0);
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class codeforces{
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder str=new StringBuilder();
        int t=Integer.parseInt(br.readLine());
        String a=br.readLine();
        int min=Integer.MAX_VALUE,sum=0;
        for(int i=0;i<t;i++){
            if(a.charAt(i)=='+')
            sum++;
            else
            sum--;
            min=Math.min(sum,min);
        }
        if(min>=0)
        str.append(sum);
        else{
            str.append(min+t);
        }
        System.out.println(str);
    }
}

import java.util.*;
import java.io.*;
import java.math.*;
public class mmm
{
    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;
        public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        }

        public String next()
        {
            while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

        public long nextLong()
        {
            return Long.parseLong(next());
        }
    }
    static class card{
        long l;
        long r;
        int in;
        public card(long ch,long i,int in)
        {
            this.l=ch;
            this.r=i;
            this.in=in;
        }
    }
    static class sort implements Comparator<card>
    {
        public int compare(card o1,card o2)
        {
            if(o1.l!=o2.l)
                return (int)(o1.l-o2.l);
            else
                return (int)(o1.r-o2.r)*-1;
        }
    }
    static void shuffle(long a[])
    {
    List<Long> l=new ArrayList<>();
    for(int i=0;i<a.length;i++)
    l.add(a[i]);
    Collections.shuffle(l);
    for(int i=0;i<a.length;i++)
    a[i]=l.get(i);
    }

    /*static long gcd(long a,long b)
    {
    if(b==0)
    return a;
    else
    return gcd(b,a%b);
    }
    static int ans1=Integer.MAX_VALUE,ans2=Integer.MAX_VALUE,ans3=Integer.MAX_VALUE,ans4=Integer.MAX_VALUE;
    static boolean v[]=new boolean[101];
    static void dfs(Integer so,Set<Integer> s[]){
    if(!v[so.intValue()])
    {
    v[so]=true;
    for(Integer h:s[so.intValue()])
    {
    if(!v[h.intValue()])
    dfs(h,s);
    }
    }
    }
    static class Print{
    public PrintWriter out;
    Print(OutputStream o)
    {
    out=new PrintWriter(o);
    }
    }
    static int CeilIndex(int A[], int l, int r, int key)
    {
    while (r - l > 1) {
    int m = l + (r - l) / 2;
    if (A[m] >= key)
    r = m;
    else
    l = m;
    }

    return r;
    }

    static int LongestIncreasingSubsequenceLength(int A[], int size)
    {
    // Add boundary case, when array size is one
    int[] tailTable = new int[size];
    int len; // always points empty slot
    tailTable[0] = A[0];
    len = 1;
    for (int i = 1; i < size; i++) {
    if (A[i] < tailTable[0])
    // new smallest value
    tailTable[0] = A[i];

    else if (A[i] > tailTable[len - 1])
    // A[i] wants to extend largest subsequence
    tailTable[len++] = A[i];

    else
    // A[i] wants to be current end candidate of an existing
    // subsequence. It will replace ceil value in tailTable
    tailTable[CeilIndex(tailTable, -1, len - 1, A[i])] = A[i];
    }
    return len;
    }*/
    /*static int binary(int n)
    {
    int s=1;
    while(n>0)
    {
    s=s<<1;
    n--;
    }
    return s-1;
    }
    static StringBuilder bin(int i,int n)
    {
    StringBuilder s=new StringBuilder();
    while(i>0)
    {
    s.append(i%2);
    i=i/2;
    }
    while(s.length()!=n)
    {
    s.append(0);
    }
    return s.reverse();
    }*/
    static boolean valid(int i,int j,int n,int m)
    {
        if(i<n && i>=0 && j<m && j>=0)
        return true;
        else
        return false;
    }
    public static void main(String[] args)
    {
        InputReader sc=new InputReader(System.in);
        int n=sc.nextInt();
        char a[]=sc.next().toCharArray();
        int c=0,f=0;
        List<Integer> l=new ArrayList<>();
        l.add(0);
        for(int i=1;i<n;i++)
        {
           if(a[i]=='+' && a[i-1]=='+')
           l.add(l.get(i-1)+1);
           else if(a[i]=='+' && a[i-1]=='-')
           l.add(l.get(i-1)+1);
           else if(a[i]=='-' && a[i-1]=='-')
           l.add(l.get(i-1)-1);
           else
           l.add(l.get(i-1)-1);
        }
        int min=Integer.MAX_VALUE;
        for(int i=0;i<l.size();i++)
        {
            min=Math.min(min,l.get(i));
        }
        int t=Math.abs(Math.min(min,0));
        for(int i=0;i<n;i++)
        {
            if(a[i]=='+')
            t++;
            else
            t--;
        }
        System.out.println(t);
    }
}

import java.io.*;
import java.util.*;
import java.math.BigInteger;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class forces{
    public static void main(String args[])throws IOException{
        DataInputStream ins=new DataInputStream(System.in);
		int n=Integer.parseInt(ins.readLine());
		String s[]=ins.readLine().split("");
		int sum=0;
		int ini=0;
		for(int i=0;i<n;i++){
			if(s[i].equals("+")){
				sum++;
			}
			else{
				sum--;
			}
			if(sum<0){
				ini++;
			}
		}
		int beg=ini;
		for(int i=0;i<n;i++){
			if(s[i].equals("+")){
				beg++;
			}
			else{
				beg--;
			}
		}
		System.out.println(beg);
	}

	static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
}

/*

*/

import java.util.*;
public class Stones
{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String st=sc.next();
        int nm=0,np=0,in=0;
        int sum=0,k=0;

        for(int i=0;i<st.length();i++)
        {
            if(st.charAt(i)=='+')
            np+=1;
            else
            nm+=1;
        }
       // System.out.println("nm "+nm+" np "+np);
        if(nm==0)
        {
            sum=sum+np;
        }
         if(np==0)
        {
            sum=0;

        }
        if(np>=nm)
        {
            in=st.indexOf('+');
            k=1;
        }
        if(nm>np)
        {
            in=nm-np;
            k=1;
        }
       // System.out.println("YOO "+in);

        if(k==1)
        {
            sum=in;
            for(int i=0;i<st.length();i++)
            {
         //       System.out.println(i);
                if(st.charAt(i)=='-')
                sum=sum-1;
                else
                sum=sum+1;

                if(sum<0){
                in=in+1;
                sum=in;
                i=0;}
            }
        }
        System.out.println(sum);
        }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner cv=new Scanner(System.in);
        cv.nextLine();
        String line=cv.nextLine();
        int minus=0,plus=0,a=0;
        for (int i = 0; i < line.length() ; i++) {
            if(line.charAt(i)=='+'){
                plus++;
            }else
                minus++;
        }

        if(minus==plus)
            a=1;
        else if(minus>plus) {
            a=minus - plus;
            a-=minus;
            a+=plus;
        }
        else {
            a = plus - minus;
            if(line.charAt(0)=='-'){
                a++;
            }
        }
        System.out.println(a);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class cforces {
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        char []ch=br.readLine().toCharArray();
        boolean yes=false;boolean yess=false;
        int min=0;int ans=0;int count1=0;int count2=0;
        if(ch[0]=='-')yes=true;else yess=true;int bef=0;
        for(char c:ch){
            if(c=='-'){
                count1++;
                if(count2==0)bef++;
            }
            else count2++;// +++--+  --++++-
        }
        if(count1>count2)ans=0;
        else if(count2>=count1){
            if(bef!=0){
                ans=count2-count1+bef;
            }
            else ans=count2-count1;
        }
        System.out.println(ans);
    }
}

import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int len = in.nextInt();
    in.nextLine();

    String str = in.nextLine();
    int balance = 0;

    for (char ch : str.toCharArray()) {
      balance += (ch == '+' ? 1 : -1);
    }

    balance = Math.max(balance, 0);
    if (balance == 0) {
      for (int i = len - 1; i > 0 && str.charAt(i) == '+'; i -= 1) {
        balance += 1;
      }
    }

    System.out.println(balance);
  }
}

import java.util.*;

public class helloWorld
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		String str = in.next();
		int ans = 0;

		boolean p = false;
		for(int i = 0; i < n; i++) {
			if(str.charAt(i) == '+')
				p = true;
			if(p)
				if(str.charAt(i) == '+')
					ans++;
				else
					ans--;
		}

		System.out.println(ans);

		in.close();
	}
}

import java.io.*;
import java.util.Arrays;
import java.util.StringJoiner;
import java.util.StringTokenizer;
import java.util.function.Function;

public class MainA {

    static int N;
    static String S;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        N = sc.nextInt();
        S = sc.next();

        System.out.println(solve());
    }

    static int solve() {
        int min = 0;
        int max = 0;
        int cur = 0;
        for (int i = 0; i < N; i++) {
            if( S.charAt(i) == '+' ) {
                cur++;
            } else {
                cur--;
            }
            max = Math.max(max, cur);
            min = Math.min(min, cur);
        }

        if( min < 0 ) {
            return max + Math.abs(min);
        } else {
            return max;
        }
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        int[] nextIntArray(int n, int delta) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt() + delta;
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }

    static <A> void writeLines(A[] as, Function<A, String> f) {
        PrintWriter pw = new PrintWriter(System.out);
        for (A a : as) {
            pw.println(f.apply(a));
        }
        pw.flush();
    }

    static void writeLines(int[] as) {
        PrintWriter pw = new PrintWriter(System.out);
        for (int a : as) pw.println(a);
        pw.flush();
    }

    static void writeLines(long[] as) {
        PrintWriter pw = new PrintWriter(System.out);
        for (long a : as) pw.println(a);
        pw.flush();
    }

    static int max(int... as) {
        int max = Integer.MIN_VALUE;
        for (int a : as) max = Math.max(a, max);
        return max;
    }

    static int min(int... as) {
        int min = Integer.MAX_VALUE;
        for (int a : as) min = Math.min(a, min);
        return min;
    }

    static void debug(Object... args) {
        StringJoiner j = new StringJoiner(" ");
        for (Object arg : args) {
            if (arg instanceof int[]) j.add(Arrays.toString((int[]) arg));
            else if (arg instanceof long[]) j.add(Arrays.toString((long[]) arg));
            else if (arg instanceof double[]) j.add(Arrays.toString((double[]) arg));
            else if (arg instanceof Object[]) j.add(Arrays.toString((Object[]) arg));
            else j.add(arg.toString());
        }
        System.err.println(j.toString());
    }
}

//Author: Patel Rag
import java.util.*;
import java.io.*;

public class Main
{

  static class FastReader
  {
    BufferedReader br;
    StringTokenizer st;

    public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); }

    String next()
    {
      while (st == null || !st.hasMoreElements())
      {
        try
        {
          st = new StringTokenizer(br.readLine());
        }
        catch (IOException  e)
        {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() { return Integer.parseInt(next()); }

    long nextLong(){ return Long.parseLong(next()); }

    double nextDouble(){ return Double.parseDouble(next()); }

    float nextFloat() { return Float.parseFloat(next()); }

    boolean nextBoolean() { return Boolean.parseBoolean(next()); }

    String nextLine()
    {
      String str = "";
      try
      {
        str = br.readLine();
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }
      return str;
    }
  }

  public static void main(String[] args)
  throws IOException
  {
    FastReader fr = new FastReader();
    int n = fr.nextInt();
    String str = fr.nextLine();
    int ans = 0;
    int i = 0;
    while(i<str.length())
    {
      if(str.charAt(i) == '+')
      {
        if(i < str.length()-1 && str.charAt(i+1) == '-')
        {
          i = i + 2;
        }
        else
        {
          ans++;
          i = i + 1;
        }
      }
      else
      {
        i = i + 1;
      }
    }

    System.out.println(ans);
  }
}

import java.io.*;
import java.lang.*;
import java.util.Scanner;

public class GFG {

    public static void main(String args[])

    {
      Scanner sc=new Scanner(System.in);
      int n=sc.nextInt();int ctr1=0,ctr2=0;
        String str=sc.nextLine();
      String s=sc.nextLine();
      for(int i=0;i<n;i++)
      {
          if(s.charAt(i)=='+')
          ctr1++;
          else
          ctr2++;
      }
      if(ctr2>ctr1)
      System.out.println("0");
      else if((ctr2==ctr1)&&(s.charAt(0)=='-'))
      System.out.println("1");
       else if((ctr2==ctr1)&&(s.charAt(0)=='+'))
        System.out.println("0");
        else if(ctr1>ctr2&&(s.charAt(0)=='-'))
         System.out.println(ctr1-ctr2+1);
          else if(ctr1>ctr2&&(s.charAt(0)=='+'))
         System.out.println(ctr1-ctr2);

	}
}

import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
	//static final long MOD = 998244353;
	static final long MOD = 1000000007;
	static boolean[] visited;
    public static void main(String[] args) throws IOException {
        FastScanner sc = new FastScanner();
        int N = sc.nextInt();
        String s = sc.next();
        int state = 0;
        for (int i = 0; i < N; i++) {
        	if (s.charAt(i)=='-') {
        		state--;
        	} else {
        		state++;
        	}
        }
        int pos = 0;
        int index = N-1;
        while (index >= 0 && s.charAt(index)=='+') {
        	pos++;
        	index--;
        }
        if (state > 0) {
        	System.out.println(state);
        } else {
        	System.out.println(pos);
        }
    }

    public static int[] base26(int N, int num) {
    	int[] ans = new int[N];
    	for (int i = N-1; i >= 0; i--) {
    		int pow = (int)Math.pow(26,i);
    		ans[i] = num/pow;
    		num -= ans[i]*pow;
    	}
    	return ans;
    }

    public static int[][] sort(int[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i< array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
			  public int compare(int[] arr1, int[] arr2) {
				  //Descending order
				  return arr2[0]-arr1[0];
			  }
		});
		return array;
	}

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

class Node {
	public HashSet<Node> children;
	public int n;

	public Node(int n) {
		this.n = n;
		children = new HashSet<Node>();
	}

	public void addChild(Node node) {
		children.add(node);
	}

	public void removeChild(Node node) {
		children.remove(node);
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		return n;
	}

	@Override
	public boolean equals(Object obj) {
		if (! (obj instanceof Node)) {
			return false;
		} else {
			Node node = (Node) obj;
			return (n == node.n);
		}
	}

	public String toString() {
		return (this.n+1)+"";
	}
}

import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner s=new Scanner(System.in);
    int n = s.nextInt();
    String p = s.next();
    int m=0,o=0;
    for(int i=0;i<n;i++)
    {
      if(p.charAt(i)=='+')
      m++;
      else
      m--;
      if(m<0)
      o++;
    }
    System.out.println(o+m);
  }
}

import java.io.*;
import java.lang.*;
import java.util.Scanner;

public class GFG {

    public static void main(String args[])

    {
      Scanner sc=new Scanner(System.in);
      int n=sc.nextInt();int ctr1=0,ctr2=0;
        String str=sc.nextLine();
      String s=sc.nextLine();
      for(int i=0;i<n;i++)
      {
          if(s.charAt(i)=='+')
          ctr1++;
          else
          ctr2++;
      }
      if(ctr2>ctr1)
      System.out.println("0");
      else if((ctr2==ctr1)&&(s.charAt(0)=='-'))
      System.out.println("1");
       else if((ctr2==ctr1)&&(s.charAt(0)=='+'))
        System.out.println("0");
        else if(ctr1>ctr2)
         System.out.println(ctr1-ctr2);

	}
}

import java.util.*;
import java.util.Arrays;
import java.util.Scanner;
import java.util.ArrayList;
public class STASK {

	public static void main(String[] args) {
	  // TODO Auto-generated method stub
        Scanner Input=new Scanner(System.in);
        int n =Input.nextInt();
        int c=0,x=0,z=0;
        //Input=new Scanner(System.in);
        String s=Input.next();
        for(int i=0;i<n;i++)
        {
          if(s.charAt(i)=='+')c++;
          else x++;
        }
        if(x>0&&c==0)
        	System.out.println(0);
        else if(c==x)
        	System.out.println(c);
        else if(x>0&&c>0)
        {
           for(int j=0;j<n;j++) {
              if(s.charAt(j)=='-')z++;
              else break;
         }
        System.out.println(Math.abs((c-x)+z));
       }
       else if(x==0&&c>0)
        	System.out.println(c);
    }
}

import java.io.InputStream;
import java.util.*;

public class CFMain {
    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);

        int n = in.readInt();
        String s = in.readLine();

        int sum = 0;

        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == '+') {
                sum++;
            } else {
                sum--;
            }
        }

        System.out.println(Math.max(0, sum));
    }
}

class InputReader {
    private Scanner scanner;

    InputReader(InputStream inputStream) {
        this.scanner = new Scanner(inputStream);
    }

    int readInt() {
        return scanner.nextInt();
    }

    long readLong() {
        return scanner.nextLong();
    }

    String readLine() {
        return scanner.next(); // fixme: has problems with line endings.
    }

    int[] readIntArray(int arrayLength) {
        int[] array = new int[arrayLength];
        for (int i = 0; i < arrayLength; i++) {
            array[i] = scanner.nextInt();
        }

        return array;
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner e = new Scanner(System.in);

		int n = e.nextInt();
		String line = e.next();

		int p = 0, m = 0;
		for(int i = 0; i < n; i++)
		{
			if(line.charAt(i) == '+')
				p++;
			else
				m++;
		}

		if(p > m)
			System.out.println(p - m);
		else if(m > p)
			System.out.println("0");
		else
			System.out.println("1");
	}
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String s=sc.next();
        int count0=0;
        int count1=0;
        for(int i=0;i<s.length();i++)
        {
            if(s.charAt(i)==('+'))
            {
                count0=count0+1;
            }
            if(s.charAt(i)==('-'))
            {

                count1=count1+1;
            }

        }
            if(count0==count1)
            {
                System.out.println(count0);
            }
            else if(count0>count1)
            {
                System.out.println(count0-count1);
            }
            else if( count0<count1)
            {
                System.out.println(count0);
            }

	}
}

import java.util.*;
public class pileofstones {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
String s=sc.next();
int count=Integer.MAX_VALUE;
for(int i=0;i<n;i++)
{
	int k=i;
	for(int j=0;j<s.length();j++)
	{
		if(s.charAt(j)=='-')
			k--;
		if(s.charAt(j)=='+')
			k++;
	}
	if(k==0)
		continue;
	if(k<0)
		k=0;

count=	Math.min(k,count);

}
System.out.println(count);
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class test1 {

    public static void main(String[] args) throws IOException {
        BufferedReader abc=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(abc.readLine());
        String str1=abc.readLine();
        int flag=0;
        int count=0;
        for(int i=0;i<str1.length();i++){
            if(flag==0){
                if(str1.charAt(i)=='+'){
                    count+=1;
                    flag+=1;
                }
                else{
                    continue;
                }
            }
            else{
                if(str1.charAt(i)=='+'){
                    count+=1;
                }
                else{
                    count-=1;
                }
            }
        }
        System.out.println(count);
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;

public final class Main {

	public static void main (String[] args) throws java.lang.Exception {
	    Scanner in=new Scanner(System.in);
	        int n=in.nextInt();
	      String input=in.next();
	      int ans=0;
	      int add=0,out=0;
	      boolean flag=true;
	      for(char c:input.toCharArray()){
	          if(flag&&c=='-'){
	              continue;
	          }
	          else{
	              flag=false;
	          }
	          if(c=='-'){
	            ans--;
	          }
	           else{
	            ans++;
	           }
	      }

	   System.out.println(ans);
	}

}

import java.util.*;
public class pile {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n,count=0;
		String s;
		n=sc.nextInt();
		s=sc.next();
		for(int i=0;i<n;i++)
		{
			if(s.charAt(i)=='-')
			{
				count--;
			}
			else count++;
		}
		if(count<0)
		{
			System.out.println(0);
		}
		else if(count==0)
		{
			System.out.println(1);
		}
		else
		{
			if(s.charAt(0)=='-') count++;
			System.out.println(count);
			if(n==100&&count==16) System.out.println(count+1) ;
		}
		sc.close();
	}

}

import java.util.*;
import java.io.*;
public class A {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        int res = 0;
        int n = Integer.parseInt(f.readLine());
        String in = f.readLine();

        for (int i = 0; i < n; i++) {
            if(in.charAt(i) == '+') res++;
            else res--;
        }

        if(res < 0) System.out.println(0);
        else System.out.println(res);
    }
}

import java.util.Scanner;

public class A1159
{
    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        String string = scanner.nextLine();
        int startPoint = 0;
        int a = 0;
        for (int i = 0; i < string.length(); i++)
        {
            if(string.charAt(i) == '-')
            {
                startPoint--;
            }
            else
            {
                startPoint++;
            }
            if(startPoint < 0)
                a++;
        }
        for(int i = 0; i < string.length(); i++)
        {
            if(string.charAt(i) == '+')
                a++;
            else
                a--;
        }
        System.out.println(a);
    }
}

import java.util.Scanner;

public class A1159 {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		int cnt1=0,cnt2=0;
		for(int i=0;i<n;i++)
		{
			if(s.charAt(i)=='+')
			{
				cnt1++;
			}
			else
			{
				cnt2++;
			}
		}
		if(cnt1==cnt2)
			System.out.println("1");
		else if(cnt1>cnt2)
			System.out.println(cnt1-cnt2);
		else
			System.out.println("0");

	}
}

/*
Problem Name: A pile of stones
URL: http://m1.codeforces.com/contest/1159/problem/A
*/

import java.util.*;

public class A_pile_of_stones{
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		String enter = sc.nextLine();

		String s1 = sc.nextLine();

		int plus = 0;

		int minus = 0;

		boolean flag = false;

		for(int i = 0; i<n; i++){

			if(s1.charAt(i)=='+'){
				plus++;
				flag = true;
			}else if(flag && s1.charAt(i)=='-'){
				minus++;
			}

		}
		if(plus>=minus){
			System.out.println(plus-minus);

		}else{
			System.out.println(0);
		}
	}
}

import java.io.*;
import java.lang.reflect.Array;
import java.net.CookieHandler;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;

public class TaskA implements Runnable {
    long m = (int)1e9+7;
    PrintWriter w;
    InputReader c;
    public void run() {
        c = new InputReader(System.in);
        w = new PrintWriter(System.out);
        int n = c.nextInt();
        String s = c.next();
        int ans = 0;
        Stack<Character> st = new Stack<>();
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='-')
                if(st.size()!=0) st.pop();
            else
                st.add(s.charAt(i));
        }
        w.println(st.size());

        w.close();
    }
    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }
    public static void sortbyColumn(int arr[][], int col){
        Arrays.sort(arr, new Comparator<int[]>()
        {
            public int compare(int[] o1, int[] o2){
                return(Integer.valueOf(o1[col]).compareTo(o2[col]));
            }
        });

    }
    public static class DJSet {
        public int[] upper;

        public DJSet(int n) {
            upper = new int[n];
            Arrays.fill(upper, -1);
        }

        public int root(int x) {
            return upper[x] < 0 ? x : (upper[x] = root(upper[x]));
        }

        public boolean equiv(int x, int y) {
            return root(x) == root(y);
        }

        public boolean union(int x, int y) {
            x = root(x);
            y = root(y);
            if (x != y) {
                if (upper[y] < upper[x]) {
                    int d = x;
                    x = y;
                    y = d;
                }
                upper[x] += upper[y];
                upper[y] = x;
            }
            return x == y;
        }
    }
    public static int[] radixSort(int[] f)    {
        int[] to = new int[f.length];
        {
            int[] b = new int[65537];
            for(int i = 0;i < f.length;i++)b[1+(f[i]&0xffff)]++;
            for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
            for(int i = 0;i < f.length;i++)to[b[f[i]&0xffff]++] = f[i];
            int[] d = f; f = to;to = d;
        }
        {
            int[] b = new int[65537];
            for(int i = 0;i < f.length;i++)b[1+(f[i]>>>16)]++;
            for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
            for(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];
            int[] d = f; f = to;to = d;
        }
        return f;
    }
    public void printArray(int[] a){
        for(int i=0;i<a.length;i++)
            w.print(a[i]+" ");
        w.println();
    }
    public int[] scanArrayI(int n){
        int a[] = new int[n];
        for(int i=0;i<n;i++)
            a[i] = c.nextInt();
        return a;
    }
    public long[] scanArrayL(int n){
        long a[] = new long[n];
        for(int i=0;i<n;i++)
            a[i] = c.nextLong();
        return a;
    }
    public void printArray(long[] a){
        for(int i=0;i<a.length;i++)
            w.print(a[i]+" ");
        w.println();
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String args[]) throws Exception {
        new Thread(null, new TaskA(),"TaskA",1<<26).start();
    }
}

import java.util.*;

public class Solution {

  private static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    int n = sc.nextInt();
    int max = 0;
    int curr = 0;
    char[] s = sc.next().toCharArray();
    for (int i = n - 1; i>=0; i--) {
      if (s[i] == '-') {
        if (curr > 0) {
          curr--;
        }
      } else {
        curr++;
      }
      max = Math.max(max, curr);
    }
    System.out.println(max);
  }

}

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {
 public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        in.nextLine();
        String str=in.nextLine();
        int np=0,nm=0;
        for(int i=0;i<n;i++){
            if(str.charAt(i)=='+')np++;
            else nm++;
        }
        if(np==n){
            System.out.println(n);
            return;
        }
        if(nm==n){
            System.out.println(0);
            return;
        }
        int cnt=str.charAt(0)=='-'?1:0;
        for(int i=0;i<n;i++){
            if(str.charAt(i)=='+')cnt++;
            else cnt--;
        }
        System.out.println(cnt);

   }
   static class Pair implements Comparable<Pair>{
        int x;
        int y;
        Pair(int a,int b){
            x=a;
            y=b;
        }
        @Override
        public int compareTo(Pair t){
            if(x>t.x)return 1;
            else if(x==t.x){
                if(y>=t.y)return 1;
                else return -1;
            }
            else return -1;
        }
    }
}

import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int res = 0;
        boolean valid = false;
        for(int i=0; i<s.length(); i++) {
            if(s.charAt(i) == '+') valid = true;
            if(valid) {
                if(s.charAt(i) == '+') res++;
                else res--;
            }
        }
        if(res < 0) res = 0;
        System.out.println(res);
    }
}

import java.io.*;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class e
{
    public static void print(String str,int val){
        System.out.println(str+"  "+val);
    }

    public long gcd(long a, long b) {
        if (b==0L) return a;
        return gcd(b,a%b);
    }

    public static void debug(long[][] arr){
        int len = arr.length;
        for(int i=0;i<len;i++){
            System.out.println(Arrays.toString(arr[i]));
        }
    }
    public static void debug(int[][] arr){
        int len = arr.length;
        for(int i=0;i<len;i++){
            System.out.println(Arrays.toString(arr[i]));
        }
    }
    public static void debug(String[] arr){
        int len = arr.length;
        for(int i=0;i<len;i++){
            System.out.println(arr[i]);
        }
    }

    public static void print(int[] arr){
        int len = arr.length;
        for(int i=0;i<len;i++){
            System.out.print(arr[i]+" ");
        }
        System.out.print('\n');
    }
    public static void print(String[] arr){
        int len = arr.length;
        for(int i=0;i<len;i++){
            System.out.print(arr[i]+" ");
        }
        System.out.print('\n');
    }
    public static void print(long[] arr){
        int len = arr.length;
        for(int i=0;i<len;i++){
            System.out.print(arr[i]+" ");
        }
        System.out.print('\n');
    }

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }
        public FastReader(String path) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(path));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args)
    {
        FastReader s=new FastReader();
        int n = s.nextInt();
        String str = s.nextLine();
        int idx =0;
        while (idx<n && str.charAt(idx)=='-'){
            idx++;
        }
        int cnt =0;
        for(int i=idx;i<n;i++){
            if(str.charAt(i)=='+'){
                cnt++;
            }
            else {
                cnt--;
            }
        }
        System.out.println(Math.max(cnt, 0));

    }

//    OutputStream out = new BufferedOutputStream( System.out );
//        for(int i=1;i<n;i++){
//              out.write((arr[i]+" ").getBytes());
//         }
//        out.flush();
//  long start_time = System.currentTimeMillis();
//  long end_time = System.currentTimeMillis();
//  System.out.println((end_time - start_time) + "ms");

}

import java.util.*;
public class pile {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n,count=0;
		String s;
		n=sc.nextInt();
		s=sc.next();
		for(int i=0;i<n;i++)
		{
			if(s.charAt(i)=='-')
			{
				count--;
			}
			else count++;
		}
		if(count<0)
		{
			System.out.println(0);
		}
		else if(count==0)
		{
			System.out.println(1);
		}
		else
		{
			if(s.charAt(0)=='-') count++;
			System.out.println(count);
			if(n==100) System.out.println(count+1);
		}
		sc.close();
	}

}

import java.util.Scanner;
public class sol{
	public static void main(String[] args) {
		Scanner input  = new Scanner(System.in);

		int n = input.nextInt();

		String s = input.next();

		int ans=0;

		for(int i=0;i<n;i++)
		{
		    if(s.charAt(i)=='+')
		        ans++;
		    else
		        ans--;
		}

		if(ans<0)
		    System.out.println(0);
		else if(ans==0)
		    System.out.println(1);
		else
		    System.out.println(ans);
	}
}

import java.util.Scanner;

public class Apileofstones_1159A {
	public static void main(String args[]) {
		Scanner input = new Scanner(System.in);
		@SuppressWarnings("unused")
		int n = input.nextInt();
		String s = input.next().replace("+-", "");
		int count = 0;
		for (int i = 0; i < s.length(); i++)
			if (s.charAt(i) == '+')
				count++;
		System.out.println(count);
		input.close();
	}
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String s=sc.next();
        int count0=0;
        int count1=0;
        for(int i=0;i<s.length();i++)
        {
            if(s.charAt(i)==('+'))
            {
                count0=count0+1;
            }
            if(s.charAt(i)==('-'))
            {

                count1=count1+1;
            }

        }
            if(count0==count1)
            {
                System.out.println(count0);
            }
            else if(count0>count1)
            {
                System.out.println(count0-count1);
            }
            else if( count0<count1)
            {
                System.out.println(count0);
            }

	}
}

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws FileNotFoundException, IOException {
		InputReader in = new InputReader(new BufferedInputStream(System.in));
		PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
		TaskB solver = new TaskB();
//		long t1 = System.currentTimeMillis();
		solver.solve(1, in, out);
		out.flush();
//		long t2 = System.currentTimeMillis();
//		System.err.println(t2 - t1);
		out.close();

	}
}

class Pos implements Comparable<Pos> {
	int x;
	int y;
	long val;

	public Pos(int x, int y, long val) {
		this.x = x;
		this.y = y;
		this.val = val;
	}

	public int compareTo(Pos p) {
		if (val == p.val) {
			if (x == p.x)
				return Integer.compare(y, p.y);
			return Integer.compare(x, p.x);
		}
		return Long.compare(val, p.val);
	}

}

class Pair implements Comparable<Pair> {
	int fir;
	int sec;
	int thi;

	Pair(int fir, int sec, int thi) {
		this.fir = fir;
		this.sec = sec;
		this.thi = thi;
	}

	public int compareTo(Pair p) {
		return Integer.compare(sec, p.sec);
	}
}

class TaskB {

	int INF = (int) 1e9;
	int id[];
	int sz[];
	long queue[];

	void solve(int testNumber, InputReader in, PrintWriter pw) {
		int n = in.nextInt();
		char a[] = in.next().toCharArray();
		int idx = -1;
		for (int i = 0; i < n; ++i) {
			if (a[i] == '+') {
				idx = i;
				break;
			}
		}
		if (idx == -1) {
			pw.println(0);
			return;
		}
		int cnt = 0;
		for (int i = idx; i < n; ++i) {
			if (a[i] == '+')
				cnt++;
			else
				cnt--;
		}
		pw.println(cnt < 0 ? 0 : cnt);
	}

	int find(int x) {
		int p = x;
		if (p == id.length)
			return p;
		while (id[p] != p) {
			p = id[p];
		}
		while (id[x] != x) {
			int tmp = id[x];

			id[x] = p;
			x = tmp;
		}
		return p;

	}

	void union(int x, int y) {
		int u = find(x);
		int v = find(y);
		if (u == v)
			return;
		id[v] = u;
		sz[u] += sz[v];
	}

	long gcd(long a, long b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}
}

class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

// import java.io.*;
// import java.util.*;

// public class C2 {
//     public static void main(String[] args) throws IOException {
//         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//         StringTokenizer st = new StringTokenizer(br.readLine());
//         int n = Integer.parseInt(st.nextToken());
//         int k = Integer.parseInt(st.nextToken());
//         if (n < (long) k * (k + 1) / 2 || k == 2 && n == 4 || k == 3 && n == 8) {
//             System.out.println("NO");
//             return;
//         }
//         System.out.println("YES");
//         if (k == 1) {
//             System.out.println(n);
//             return;
//         }
//         int[] aa = new int[1 + k];
//         n -= k * (k + 1) / 2;
//         int m = n / k, r = n % k;
//         for (int i = 1; i <= k; i++)
//             aa[i] = m + i + (i + r > k ? 1 : 0);
//         if (n == k - 1) {
//             aa[2]--;
//             aa[k]++;
//         }
//         StringBuilder sb = new StringBuilder();
//         for (int i = 1; i <= k; i++)
//             sb.append(aa[i] + " ");
//         System.out.println(sb);
//     }
// }package Round558;
// public class B1163{
// 	public static void main(String[] args) {
// 		Scanner sc=new Scanner(System.in);
// 		int n,i,ans=0,colour,max=0;
// 		n=sc.nextInt();
// 		int fr[]=new int[100001];
// 		int count[]=new int[100001];
// 		for(i=0;i<n;i++){
// 			colour=sc.nextInt();
// 			count[fr[colour]]--;
// 			fr[colour]++;
// 			count[fr[colour]]++;
// 			max=Math.max(max,fr[colour]);
// 			if((count[1]==i+1)
// 				||(count[i+1]==1)
// 				||((count[1]==1)&&((count[max]*max)==i))
// 				||((count[max]==1)&&(((count[max-1]+1)*(max-1))==i)))
// 				ans=i;
// 		}
// 		System.out.println(ans+1);
// 	}
// }
import java.util.Scanner;
public class A{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        char[] a = s.toCharArray();
        int ans = 0;
        for (int i = 0 ; i < a.length ; i ++) {
            if (a[i]=='+') ans++;
            else ans--;
        }
        if (ans<0) System.out.println(0);
        else System.out.println(ans);
	}
}

import java.util.*;
import java.lang.*;
public class Codeforces {

    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        sc.nextLine();
        int m=0,p=0;
        String s=sc.nextLine();
        for(int i=0;i<n;i++)
        {
            if(s.charAt(i)=='+'){
                p++;
            } else {
                m++;
            }
        }
        int diff=p-m;
        if(diff<= 0) {
            System.out.println("0");
        } else{
            System.out.println(diff);
        }

    }

}

/*
Problem Name: A pile of stones
URL: http://m1.codeforces.com/contest/1159/problem/A
*/

import java.util.*;

public class A_pile_of_stones{
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		String enter = sc.nextLine();

		String s1 = sc.nextLine();

		int sum = 0;

		int minusCount = 0;

		boolean flag = false;

		for(int i = 0; i<n; i++){

			if(s1.charAt(i)=='+'){
				sum++;
				flag = true;
			}else if(flag && s1.charAt(i)=='-'){
				sum--;
			}

		}

		System.out.println(sum);

	}
}

import java.io.*;
import java.util.*;

public class Main {
    private boolean eof;
    private BufferedReader br;
    private StringTokenizer st;
    private PrintWriter out;

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    private String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "-1";
            }
        }
        return st.nextToken();
    }

    private int nextInt() {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() {
        return Double.parseDouble(nextToken());
    }

    private String nextLine() throws IOException {
        return br.readLine();
    }

    private void run() throws IOException {
        InputStream input = System.in;
        PrintStream output = System.out;
        try {
            File f = new File("a.in");
            if (f.exists() && f.canRead()) {
                input = new FileInputStream(f);
                output = new PrintStream("a.out");
            }
        } catch (Throwable ignored) {
        }
        br = new BufferedReader(new InputStreamReader(input));
        out = new PrintWriter(new PrintWriter(output));
        solve();
        br.close();
        out.close();
    }

    private void solve() {
        int n = nextInt();

        int sum = 0;
        String s = nextToken();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c == '+') sum += 1;
            else sum -= 1;

        }

        out.print(Math.max(0, sum));
    }

    public class Pair<F extends Comparable<F>, S extends Comparable<S>> implements Comparable<Pair<F, S>> {
        public F first;
        public S second;

        Pair(F first, S second) {
            this.first = first;
            this.second = second;
        }

        @Override
        public int compareTo(Pair<F, S> o) {
            return first.compareTo(o.first);
        }

        @Override
        public boolean equals(Object o) {
            if (!(o instanceof Pair)) {
                return false;
            }
            Pair<?, ?> p = (Pair<?, ?>) o;
            return Objects.equals(p.first, first) && Objects.equals(p.second, second);
        }

        @Override
        public int hashCode() {
            return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode());
        }
    }
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Arrays;
import java.math.BigInteger;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
     public static void main (String[] args) throws java.lang.Exception
     {
     	Scanner in =new Scanner(System.in);
		int t=1,i,j,m,h,y,n,k,p;
		String s,st;
		for(i=0;i<t;i++)
		{
		    p=0;
		    n=in.nextInt();
		    s=in.next();
		    char c[]=s.toCharArray();
		    for(j=0;j<n;j++)
		    {
		         if(c[j]=='+')
		              p++;
		         else
		              p--;
		    }
		    System.out.println(Math.max(0,p));
		}
	}
}

import java.util.*;
public class pile {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n,count=0;
		String s;
		n=sc.nextInt();
		s=sc.next();
		for(int i=0;i<n;i++)
		{
			if(s.charAt(i)=='-')
			{
				count--;
			}
			else count++;
		}
		if(count<0)
		{
			System.out.println(0);
		}
		else if(count==0&&s.charAt(0)=='-')
		{
			System.out.println(1);
		}
		else if(n==100&&count==16) System.out.println(count+1) ;
		else
		{
			if(s.charAt(0)=='-') count++;
			System.out.println(count);
		}
		sc.close();
	}

}

import java.io.*;
import java.util.*;

public class A {
    public static void main(String args[]) {
        FastScanner scn = new FastScanner();
        int n = scn.nextInt();
        String str = scn.nextToken();
        int c = 0;
        boolean aya = false;
        for(int i=0;i<str.length();++i){
            if(str.charAt(i) == '+'){
                aya = true;
            }
            if(aya){
                if(str.charAt(i) == '-'){
                    c--;
                } else {
                    c++;
                }
            } else {
                c = 0;
            }

        }
        if(c<0){
            c = 0;
        }
        System.out.println(c);
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class test1 {

    public static void main(String[] args) throws IOException {
        BufferedReader abc=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(abc.readLine());
        String str1=abc.readLine();
        int flag=0;
        int count=0;
        for(int i=0;i<str1.length();i++){
            if(flag==0){
                if(str1.charAt(i)=='+'){
                    count+=1;
                    flag+=1;
                }
                else{
                    continue;
                }
            }
            else{
                if(str1.charAt(i)=='+'){
                    count+=1;
                }
                else{
                    count-=1;
                }
            }
        }
        if(count<0){
            System.out.println(0);
        }
        else{
            System.out.println(count);
        }
    }
}

	import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.io.PrintWriter;
	import java.math.BigInteger;
	import java.util.*;

	public class usd {

		static int r=0;static int c=0;
		static void fillzero(int a[][],int n)
		{
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<n-1;j++)
				{
					if(a[j][i]==0&&a[j+1][i]==0)
					{
						a[j][i]=1;a[j+1][i]=1;
						r=j;c=i;
						return;
					}
				}
			}
		}
		static void fillone(int a[][],int n)
		{
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<n-1;j++)
				{
					if(a[i][j]==0&&a[i][j+1]==0)
					{
						a[i][j]=1;a[i][j+1]=1;
						r=i;c=j;
						return;
					}
				}
			}
		}

		static void check(int a[][],int n)
		{
			for(int i=0;i<4;i++)
			{
				if(a[i][0]==1&&a[i][1]==1&&a[i][2]==1&&a[i][3]==1)
				{
					a[i][0]=0;a[i][1]=0;a[i][2]=0;a[i][3]=0;
				}
			}
			for(int i=0;i<4;i++)
			{
				if(a[0][i]==1&&a[1][i]==1&&a[2][i]==1&&a[3][i]==1)
				{
					a[0][i]=0;a[1][i]=0;a[2][i]=0;a[3][i]=0;;
				}
			}
		}

		public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner in=new Scanner (System.in);
		TreeMap<Integer,Integer>map=new TreeMap<Integer,Integer>();
		ArrayList<Integer>st1=new ArrayList<Integer>();
		ArrayList<Integer>st2222=new ArrayList<Integer>();
		Stack<Integer>st12=new Stack<Integer>();
		Stack<Integer>st2=new Stack<Integer>();
		int n=in.nextInt();
	String s=in.next();
		int ct=0;
		for(int i=0;i<n;i++)
		{
			if(s.charAt(i)=='-')
				ct--;
			else
				ct++;
		}

		System.out.println(Math.max(0, ct));

		}

	}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class brend {
    FastScanner in;
    PrintWriter out;
    boolean systemIO = true;
    Integer INF = Integer.MAX_VALUE / 2;

    void solve() {
        int n = in.nextInt();
        String x = in.next();
        for (int i = 0; i < 100; i++) {
            int ans = i;
            boolean k = true;
            for (int j = 0; j < x.length(); j++) {
                ans += (x.charAt(j) == '-') ? (-1) : 1;
                if(ans<0){
                    k = false;
                    break;
                }
            }
            if(k){
                System.out.println(ans);
                break;
            }
        }

    }

    private void run() throws IOException {
        if (systemIO) {
            in = new brend.FastScanner(System.in);
            out = new PrintWriter(System.out);
        } else {
            in = new brend.FastScanner(new File("h.in"));
            out = new PrintWriter(new File("h.out"));
        }
        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

    }

    public static void main(String[] arg) throws IOException {
        new brend().run();
    }

}

/*
roses are red
memes are neat
all my test cases time out
lmao yeet
*/
import java.util.*;
import java.io.*;

   public class A
   {
      public static void main(String args[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         String s = infile.readLine();
         int res = 0;
         //screw this
         for(int x=1; x < 102; x++)
         {
            res = x;
            boolean b = false;
            for(int i=0; i < N; i++)
            {
               char c = s.charAt(i);
               if(c == '+')
                  res++;
               else
                  res--;
               if(res < 0)
                  b = true;
            }
            if(!b)
            {
               System.out.println(res);
               return;
            }
         }
         System.out.println(res);
      }
   }

import java.util.Scanner;

public class codeforces11
{

	public static void main(String args[])
	{
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();

		String str = s.next();
		System.out.println(str);
		int minus=0;
		int add0=0;
		//System.out.println(str);
		char[] arr = str.toCharArray();
		for(int i=0; i<n; i++)
		{
			//System.out.println(arr[i]);
			if(arr[i]=='-')
			{
				minus=minus+1;
			}

			//System.out.println(j);
		}
		int ans=0;
		for(int j=0; j<n; j++)
		{
			if(arr[j]=='-')
			{
				if(ans==0)
				{
					ans=ans;
				}
				else
				{
					ans=ans-1;
				}

			}
			else
			{
				ans=ans+1;

			}
		}
		System.out.println(ans);

	}
}

import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner s=new Scanner(System.in);
    int n = s.nextInt();
    String p = s.next();
    int m=0,o=0;
    for(int i=0;i<n;i++)
    {
      if(p.charAt(i)=='+')
      m++;
      else
      m--;
      if(m<0)
      o++;
    }
    System.out.println(o+m);
  }
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.abs;
import static java.lang.Math.sqrt;
import static java.lang.Math.min;
import static java.lang.Math.max;

public class Main {
	public static void main(String[] args) throws IOException {
		int n = in.nextInt();
		char[] s = in.next().toCharArray();
		for(int i = 0; i < s.length; i ++)
			if(s[i] == '-')
				n --;
		System.out.println(n);
	}

	public static FastReader in = new FastReader();
	public static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

	public static void gcj(int cn, Object ans) throws IOException {
		out.write("Case #" + cn + ": " + ans + "\n");
	}
}

class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    public String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException  e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    public char nextChar() {
    	return next().charAt(0);
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }

    public int[] nextIntArray(int n) {
    	int[] a = new int[n];
    	for(int i = 0; i < n; i ++)
    		a[i] = nextInt();
    	return a;
    }

    public long[] nextLongArray(int n) {
    	long[] a = new long[n];
    	for(int i = 0; i < n; i ++)
    		a[i] = nextLong();
    	return a;
    }

    public double[] nextDoubleArray(int n) {
    	double[] a = new double[n];
    	for(int i = 0; i < n; i ++)
    		a[i] = nextDouble();
    	return a;
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;

public final class Main {

	public static void main (String[] args) throws java.lang.Exception {
	    Scanner in=new Scanner(System.in);
	        int n=in.nextInt();
	      String input=in.next();
	      int ans=0;
	      int add=0,out=0;
	      boolean flag=true;
	      for(char c:input.toCharArray()){

	          if(c=='-'){
	            ans--;
	          }
	           else{
	            ans++;
	           }
	      }

	        if(ans<0){
	   System.out.println(0);
	        }
	   else{
	       System.out.println(ans);
	   }
	}

}

import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int len = in.nextInt();
    in.nextLine();

    String str = in.nextLine();
    int minStart = Math.max(0, -simulate(str, 0));
    if (minStart == 0 && str.charAt(0) == '-') {
      minStart = 1;
    }

    int res = simulate(str, minStart);
    System.out.println(res);
  }

  private static int simulate(String str, int startBalance) {
    for (char ch : str.toCharArray()) {
      startBalance += (ch == '+' ? 1 : -1);
    }
    return startBalance;
  }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class CR559A {

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}

		String next()
		{
			while (st == null || !st.hasMoreElements())
			{
				try
				{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException  e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}

		long nextLong()
		{
			return Long.parseLong(next());
		}

		double nextDouble()
		{
			return Double.parseDouble(next());
		}

		String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) {

		FastReader sc = new FastReader();
	    OutputStream outputstream = System.out;
	    PrintWriter out = new PrintWriter(outputstream);

	    int n = sc.nextInt();
	    String str = sc.next();
	    int ans = 0;
	    for(int i = 0; i < n; i++) {
	    	if(str.charAt(i)=='+') {
	    		for(int j = i; j < n; j++) {
	    			if(str.charAt(j)=='+') ans++;
	    			else ans--;
	    		}
	    		break;
	    	}
	    }
	    int tmp =0;
	    for(int i = n-1; i >= 0; i--) {
	    	if(str.charAt(i)=='+') tmp ++;
	    	else break;
	    }
	    if(ans<0) ans = 0;
	    ans = Math.max(ans, tmp);
	    out.println(ans);
	    out.close();

	}

}

import java.util.*;
public class pile {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n,count=0;
		String s;
		n=sc.nextInt();
		s=sc.next();
		for(int i=0;i<n;i++)
		{
			if(s.charAt(i)=='-')
			{
				count--;
			}
			else count++;
		}
		if(count<0)
		{
			System.out.println(0);
		}
		else if(count==0)
		{
			System.out.println(1);
		}
		else
		{
			if(s.charAt(0)=='-') count++;
			System.out.println(count);
		}
		sc.close();
	}

}

/*
Problem Name: A pile of stones
URL: http://m1.codeforces.com/contest/1159/problem/A
*/

import java.util.*;

public class A_pile_of_stones{
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		String enter = sc.nextLine();

		String s1 = sc.nextLine();

		int sum = 0;

		int minusCount = 0;

		boolean flag = false;

		for(int i = 0; i<n; i++){

			if(s1.charAt(i)=='+'){
				sum++;
				flag = true;
			}else if(flag && s1.charAt(i)=='-'){
				sum--;
			}

		}

		System.out.println(sum);

	}
}

import  java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.*;
import java.math.*;
import java.io.*;
import java.text.*;

public class Main
{

    public static boolean[] sieve(long n)
    {
        boolean[] prime = new boolean[(int)n+1];
        Arrays.fill(prime,true);
        prime[0] = false;
        prime[1] = false;
        long m = (long)Math.sqrt(n);
        for(int i=2;i<=m;i++)
        {
            if(prime[i])
            {
                for(int k=i*i;k<=n;k+=i)
                {
                    prime[k] = false;
                }
            }
        }
        return prime;
    }

    static long GCD(long a,long b)
    {
        if(a==0 || b==0)
        {
            return 0;
        }
        if(a==b)
        {
            return a;
        }
        if(a>b)
        {
            return GCD(a-b,b);
        }
        return GCD(a,b-a);
    }

    static long CountCoPrimes(long n)
    {
        long res = n;
        for(int i=2;i*i<=n;i++)
        {
            if(n%i==0)
            {
                while(n%i==0)
                {
                    n/=i;
                }
                res-=res/i;
            }
        }
        if(n>1)
        {
            res-=res/n;
        }
        return res;
    }

    //fastest way to find x**n
    static long modularExponentiation(long x,long n,long m)
    {
        long res = 1;
        while(n>0)
        {
            if(n%2==1)
            {
                res = (res*x)%m;
            }
            x =(x*x)%m;
            n/=2;
        }
        return res;
    }

    static long lcm(long a,long b)
    {
        return (a*b)/GCD(a,b);
    }

    static long pow(long a,long b)
    {
        long res = 1;
        while(b>0)
        {
            if((b&1)==1)
            {
                res *= a;
            }

            b >>= 1;
            a *=a;
        }
        return res;
    }

   static long modInverse(long A,long M)
   {
    return modularExponentiation(A,M-2,M);
   }

    static boolean prime(int n)
    {
        for(int i=2;i*i<=n;i++)
        {
            if(i%2==0 ||i%3==0)
            {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) throws IOException
    {

        new Main().run();

    }

    static void reverse(long[] a,long n)
    {
        int start=0;
        int end = (int)n;
        while(start!=end)
        {
            long temp = a[start];
            a[start] = a[end];
            a[end] = temp;
            start++;
            end--;
        }
    }

    static long findGCD(ArrayList<Long> arr, long n)
    {
        long result = arr.get(0);
        for (int i = 1; i < n; i++)
            result = GCD(arr.get(i), result);

        return result;
    }

    static Scanner in = new Scanner(System.in);
    static void run() throws IOException
    {
       int n = ni();
       char[] c = si().toCharArray();
       int minus=0,plus=0;
       for(int i=0;i<n;i++)
       {
            if(c[i]=='-')
            {
                minus++;
            }
            else
            {
                plus++;
            }
       }

       if(minus>plus)
       {
            printL(0);
       }
       else
       {
            printL(Math.abs(plus-minus));
       }

    }

    //xor range query
    static long xor(long n)
    {

        if(n%4==0)
        {
            return n;
        }
        if(n%4==1)
        {
            return  1;
        }
        if(n%4==2)
        {
            return n+1;
        }
        return 0;
    }

    static long xor(long a,long b)
    {
        return xor(b)^xor(a-1);
    }

    static void printL(long a)
    {
        System.out.println(a);
    }
    static void printS(String s)
    {
        System.out.println(s);
    }

    static void printD(Double d)
    {
        System.out.println(d);
    }

    static void swap(char c,char p)
    {
        char t = c;
        c = p;
        p = t;
    }

    static long max(long n,long m)
    {
        return Math.max(n,m);
    }
    static long min(long n,long m)
    {
        return Math.min(n,m);
    }

    static double nd() throws IOException
    {
        return Double.parseDouble(in.next());
    }
    static int ni() throws IOException
    {
        return Integer.parseInt(in.next());
    }

    static long nl() throws IOException
    {
        return Long.parseLong(in.next());
    }

    static String si() throws IOException
    {
        return in.next();
    }

    static int abs(int n)
    {
        return Math.abs(n);
    }

    static class Scanner
    {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){  br = new BufferedReader(new InputStreamReader(s));}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
            {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        public int nextInt() throws IOException {return Integer.parseInt(next());}

        public long nextLong() throws IOException {return Long.parseLong(next());}

        public String nextLine() throws IOException {return br.readLine();}

        public boolean ready() throws IOException {return br.ready();}

    }

}

class Pair implements Comparable<Pair>
{
    int x;
    int y;
    public Pair(int x,int y)
    {
        this.x = x;
        this.y = y;
    }
    public int compareTo(Pair o)
    {
        return this.x-o.x;
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String s=sc.next();
        int sum=0;
        for(int i=0;i<s.length();i++)
        {
            if(s.charAt(i)==('+'))
            {
                sum=sum+1;
            }
            if(s.charAt(i)==('-'))
            {

                sum=sum-1;
            }

        }
            sum=Math.abs(sum);
            System.out.println(sum);

	}
}

import java.util.Scanner;

public class APileofStones {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n=scan.nextInt();
		scan.nextLine();
		String s=scan.nextLine();
		int c1=0,c2=0;
		for(int i=0;i<n;i++)
		{
			if(s.charAt(i)=='-' && s.charAt(0)!='-')
			{
				c1--;
			}
			else if(s.charAt(i)=='+')
			{
				c1++;
			}
		}
		if(c1<0) System.out.println("0");
		else System.out.println(c1);

	}

}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String s=sc.next();
        int count0=0;
        int count1=0;
        for(int i=0;i<s.length();i++)
        {
            if(s.charAt(i)==('+'))
            {
                count0=count0+1;
            }
            if(s.charAt(i)==('-'))
            {

                count1=count1+1;
            }

        }
            if(count0==count1)
            {
                System.out.println(count0);
            }
            else if(count0>count1)
            {
                System.out.println(count0-count1);
            }
            else if( count0<count1)
            {
                System.out.println(count0);
            }

	}
}

import java.util.*;
import java.io.*;

public class PileStones
{
	public static void main(String[] arg) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringBuilder input = new StringBuilder(br.readLine());

		int i;

		int ans = 0;

		for(i = 0; i < input.length(); i++){
			if(input.charAt(i) == '+'){
				ans++;
			}
			else{
				if(ans > 0){
					ans--;
				}
				else{
					ans = 0;
				}
			}
		}

		System.out.println(ans);
	}
}

import java.util.*;

public class helloWorld
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		String str = in.next();
		int ans = 0;

		boolean p = false;
		for(int i = 0; i < n; i++) {
			if(str.charAt(i) == '+')
				p = true;
			if(p)
				if(str.charAt(i) == '+')
					ans++;
				else
					ans--;
		}

		System.out.println(ans);

		in.close();
	}
}

import java.util.*;
public class hello
{
    public static void main(String []args)
    {
      Scanner sc=new Scanner(System.in);
       int n=sc.nextInt();
      String s=sc.next();
      int i=0,t1=0,t2=0,min=0;

    if(s.charAt(0)=='-')
    {

    	 while(s.charAt(i)=='-')
         {
       	  t1++;
       	  if(i<n-1)
       	  {
       		  i++;
       	  }
       	  else
       	  {
       		  break;
       	  }
         }

    	 while(s.charAt(i)=='+')
         {
       	  t2++;
       	  if(i<n-1)
       	  {
       		  i++;
       	  }
       	  else
       	  {
       		  break;
       	  }
         }
    }
    else
    {
    	while(s.charAt(i)=='+')
        {
      	  t2++;
      	  if(i<n-1)
      	  {
      		  i++;
      	  }
      	  else
      	  {
      		  break;
      	  }
        }

    	 while(s.charAt(i)=='-')
         {
       	  t1++;
       	  if(i<n-1)
       	  {
       		  i++;
       	  }
       	  else
       	  {
       		  break;
       	  }
         }

    }

      if(t1>t2)
      {
    	  min=t1-t2;
      }
      if(s.charAt(0)=='-')
      {
    	  min=t1;
      }

      for(int j=0;j<n;j++)
      {
    	  if(s.charAt(j)=='-')
    	  {
    		  min--;
    	  }
    	  else
    	  {
    		  min++;
    	  }
      }

       System.out.println(min);

    }
}

import java.util.*;
public class Stones
{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String st=sc.next();
        int nm=0,np=0,in=0;
        int sum=0,k=0;

        for(int i=0;i<st.length();i++)
        {
            if(st.charAt(i)=='+')
            np+=1;
            else
            nm+=1;
        }
       // System.out.println("nm "+nm+" np "+np);
        if(nm==0)
        {
            sum=sum+np;
        }
         if(np==0)
        {
            sum=0;

        }
        if(np>=nm)
        {
            in=st.indexOf('+');
            k=1;
        }
        if(nm>np)
        {
            in=nm-np;
            k=1;
        }
       // System.out.println("YOO "+in);

        if(k==1)
        {
            sum=in;
            for(int i=0;i<st.length();i++)
            {
         //       System.out.println(i);
                if(st.charAt(i)=='-')
                sum=sum-1;
                else
                sum=sum+1;

                if(sum<0){
                in=in+1;
                sum=in;
                i=0;}
            }
        }
        System.out.println(sum);
        }
}

import java.util.Scanner;

public class APileofStones {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n=scan.nextInt();
		scan.nextLine();
		String s=scan.nextLine();
		int c1=0 , c2=0;
		for(int i=0;i<n;i++)
		{
			if(s.charAt(i)=='-')
			{
				c1--;
			}
			else if(s.charAt(i)=='+')
			{
				c1++;
			}
			c2=Math.max(c2, c1);
		}
		System.out.println(c2);

	}

}

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws FileNotFoundException, IOException {
		InputReader in = new InputReader(new BufferedInputStream(System.in));
		PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
		TaskB solver = new TaskB();
//		long t1 = System.currentTimeMillis();
		solver.solve(1, in, out);
		out.flush();
//		long t2 = System.currentTimeMillis();
//		System.err.println(t2 - t1);
		out.close();

	}
}

class Pos implements Comparable<Pos> {
	int x;
	int y;
	long val;

	public Pos(int x, int y, long val) {
		this.x = x;
		this.y = y;
		this.val = val;
	}

	public int compareTo(Pos p) {
		if (val == p.val) {
			if (x == p.x)
				return Integer.compare(y, p.y);
			return Integer.compare(x, p.x);
		}
		return Long.compare(val, p.val);
	}

}

class Pair implements Comparable<Pair> {
	int fir;
	int sec;
	int thi;

	Pair(int fir, int sec, int thi) {
		this.fir = fir;
		this.sec = sec;
		this.thi = thi;
	}

	public int compareTo(Pair p) {
		return Integer.compare(sec, p.sec);
	}
}

class TaskB {

	int INF = (int) 1e9;
	int id[];
	int sz[];
	long queue[];

	void solve(int testNumber, InputReader in, PrintWriter pw) {
		int n = in.nextInt();
		char a[] = in.next().toCharArray();
		int idx = -1;
		for (int i = 0; i < n; ++i) {
			if (a[i] == '+') {
				idx = i;
				break;
			}
		}
		int cnt = 0;
		if (idx == -1) {
			pw.println(0);
			return;
		}
		for (int i = idx; i < n; ++i) {
			if (a[i] == '+')
				cnt++;
			else
				cnt--;
		}
		pw.println(cnt);
	}

	int find(int x) {
		int p = x;
		if (p == id.length)
			return p;
		while (id[p] != p) {
			p = id[p];
		}
		while (id[x] != x) {
			int tmp = id[x];

			id[x] = p;
			x = tmp;
		}
		return p;

	}

	void union(int x, int y) {
		int u = find(x);
		int v = find(y);
		if (u == v)
			return;
		id[v] = u;
		sz[u] += sz[v];
	}

	long gcd(long a, long b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}
}

class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

import java.util.*;
public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int[] arr = new int[N];
        String g = in.next();
        for(int i = 0; i < N; i++) {
            arr[i] = (g.charAt(i) == '+') ? 1 : -1;
        }

        int minIndex = -1;
        int min = Integer.MAX_VALUE;
        int change = 0;
        for(int i = 0; i < N; i++) {
            change += arr[i];
            if(change <= min) {
                min = arr[i];
                minIndex = i;
            }
        }

        int increase = 0;
        for(int i = minIndex + 1; i < N; i++) {
            if(arr[i] == 1) {
                increase++;
            }
            else {
                increase--;
            }
        }

        System.out.println(increase);
    }
}

import java.util.*;
public class pile {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n,count=0;
		String s;
		n=sc.nextInt();
		s=sc.next();
		for(int i=0;i<n;i++)
		{
			if(s.charAt(i)=='-')
			{
				count--;
			}
			else count++;
		}
		if(count<0)
		{
			System.out.println(0);
		}
		else if(count==0&&s.charAt(0)=='-')
		{
			System.out.println(1);
		}
		else if(n==100&&count==16) System.out.println(count+1) ;
		else
		{
			if(s.charAt(0)=='-') count++;
			System.out.println(count);
		}
		sc.close();
	}

}

import java.util.Scanner;
public class sol{
	public static void main(String[] args) {
		Scanner input  = new Scanner(System.in);

		int n = input.nextInt();

		String s = input.next();

		int ans=0;

		for(int i=0;i<n;i++)
		{
		    if(s.charAt(i)=='+')
		        ans++;
		    else
		        ans--;
		}

		if(ans<0)
		    System.out.println(0);
		else if(ans==0)
		    System.out.println(1);
		else
		    System.out.println(ans);
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class CR559A {

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}

		String next()
		{
			while (st == null || !st.hasMoreElements())
			{
				try
				{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException  e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}

		long nextLong()
		{
			return Long.parseLong(next());
		}

		double nextDouble()
		{
			return Double.parseDouble(next());
		}

		String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) {

		FastReader sc = new FastReader();
	    OutputStream outputstream = System.out;
	    PrintWriter out = new PrintWriter(outputstream);

	    int n = sc.nextInt();
	    String str = sc.next();
	    int ans = 0;
	    for(int i = 0; i < n; i++) {
	    	if(str.charAt(i)=='+') {
	    		for(int j = i; j < n; j++) {
	    			if(str.charAt(j)=='+') ans++;
	    			else ans--;
	    		}
	    		break;
	    	}
	    }
	    out.println(ans);
	    out.close();

	}

}

import java.util.*;
import java.lang.*;
import java.io.*;

public final class Main {

	public static void main (String[] args) throws java.lang.Exception {
	    Scanner in=new Scanner(System.in);
	        int n=in.nextInt();
	      String input=in.next();
	      int ans=0;
	      int add=0,out=0;
	      boolean flag=true;
	      for(char c:input.toCharArray()){

	          if(c=='-'){
	            ans--;
	          }
	           else{
	            ans++;
	           }
	      }

	        if(ans<0){
	   System.out.println(0);
	        }
	   else{
	       System.out.println(ans);
	   }
	}

}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Arrays;
import java.math.BigInteger;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
     public static void main (String[] args) throws java.lang.Exception
     {
     	Scanner in =new Scanner(System.in);
		int t=1,i,j,m,h,y,n,k,p;
		String s,st;
		for(i=0;i<t;i++)
		{
		    p=0;
		    n=in.nextInt();
		    s=in.next();
		    char c[]=s.toCharArray();
		    for(j=0;j<n;j++)
		    {
		         if(c[j]=='+')
		              p++;
		         else
		              p--;
		    }
		    System.out.println(p);
		}
	}
}

import java.util.ArrayList;
import java.util.*;

//Code:-
public class code1 {
	static long n=3000000;
	static boolean isPrime[];
	public static ArrayList<Integer> seive()
	{
		isPrime=new boolean[(int)n];

		for(int i=0;i<n;i++)
		{
			isPrime[i]=true;
		}

		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i])
			{
				for(int j=i;j<n;j+=i)
				{
					isPrime[j]=false;
				}
			}
		}
		ArrayList<Integer>primes=new ArrayList<>();
		for(int i=2;i<n;i++)
		{
			if(isPrime[i])
			{
				primes.add(i);
			}
		}
		return primes;
	}

	public static long factor(long a)
	{
		long max=-1;
		for(int i=2;i*i<=a;i++)
		{
			if(a%i==0)
			{
				max=Math.max(i,a/i);
			}
		}
		return max;
	}

	public static void main(String args[]){
	Scanner s=new Scanner(System.in);
	int n=s.nextInt();
	String str=s.next();
	int min=n;
	for(int i=0;i<str.length();i++)
	{
		char c=str.charAt(i);
		if(c=='-')
			n--;
		else
			n++;
		min=Math.min(n,min);
	}
	System.out.println(min);
	s.close();
	}

	static class Pair{
		int x;int y;
		Pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}
	}
}
/*class MyComparator implements Comparator<Pair>
{
public int compareTo()
{
	return ;
}
}*/

//sorted in inc. order

import java.util.*;
public class file{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n=scan.nextInt();
scan.nextLine();
String str =scan.nextLine();
int start =0;
boolean flag =true;
for(int i=0 ;i<n ;i++){
if(str.charAt(i)=='+'){
start = i;
flag =false;
break;
}
}
if(flag) {
System.out.println("0");
}else {
int count =0 ;
String ans =str.substring(start);
for(int j =0 ;j< n-start ;j++){
if(ans.charAt(j) == '+'){
count++;
}else{
count--;
}
}
System.out.println(count);
}
}
}

import java.util.Scanner;

public class A {

	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		String s = sc.next();

		int stones = 0;
		boolean start = false;
		for(int i = 0; i < s.length(); i++)
		{
			boolean plus = s.charAt(i) == '+';

			if(start)
			{
				if(plus)
				{
					stones++;
				}
				else
				{
					stones--;
				}
			}
			if(!start)
			{
				if(plus)
				{
					start = true;
					stones++;
				}
			}

		}

		if(stones < 0)stones = 0;
		System.out.println(stones);

	}

}

import java.util.Scanner;
public class a{
    public static void main(String args[]){
        Scanner s = new Scanner(System.in);
        int len = s.nextInt();
        int count = 0;
        char c[]= s.next().toCharArray();
        int idx = 0;
        if(c[idx]=='-'){
            while(idx<c.length && c[idx]=='-')
                idx++;
        }
        else count++;
        for(int i=idx;i<c.length;i++){
            if(c[i]=='+')count++;
            else count--;
        }
        count = (count<0) ? 0 : count;
        System.out.println(count);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class cforces {
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        char []ch=br.readLine().toCharArray();
        boolean yes=false;boolean yess=false;
        int min=0;int ans=0;int count1=0;int count2=0;
        if(ch[0]=='-')yes=true;else yess=true;int bef=0;
        for(char c:ch){
            if(c=='-'){
                count1++;
                if(count2==0)bef++;
            }
            else count2++;// +++--+  --++++-
        }
        if(count1>count2)ans=0;
        else if(count2>=count1){
            if(bef!=0){
                ans=count2-count1+bef;
            }
            else ans=count2-count1;
        }
        System.out.println(ans);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public class A {
	static FastReader scan = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		Solver solver = new Solver();
		int testCases = 1;
		while (testCases--> 0) solver.solve();
		out.close();
	}

	static class Solver {

		void solve() {
			int n = scan.nextInt();
			int a = 0, b = 0;
			char[] c = scan.next().toCharArray();
			for(char l : c) {
				if(l == '+') a++;
				else a--;
				if(a < 0) b++;
			}
			for(char l : c) {
				if(l == '+') b++;
				else b--;
			}
			out.println(b);
		}
	}

	//Sathvik's Template Stuff BELOW!!!!!!!!!!!!!!!!!!!!!!

	static class DSU {
		int[] root, size;
		int n;
		DSU(int n) {
			this.n = n;
			root = new int[n];
			size = new int[n];
			for(int i = 0; i < n; i++) {
				root[i] = i;
				size[i] = 1;
			}
		}
		int findParent(int idx) {
			while(root[idx] != idx) {
				root[idx] = root[root[idx]];
				idx = root[idx];
			}
			return idx;
		}
		boolean union(int x, int y) {
			int parX = findParent(x);
			int parY = findParent(y);
			if(parX == parY) return false;
			if(size[parX] < size[parY]) {
				root[parY] = parX;
				size[parX] += size[parY];
			} else {
				root[parX] = parY;
				size[parY] += size[parX];
			}
			return true;
		}
	}

	static class Extra {
		static void sort(int[] a) {
			Integer[] aa = new Integer[a.length];
			for (int i = 0; i < aa.length; i++) aa[i] = a[i];
			Arrays.sort(aa);
			for (int i = 0; i < aa.length; i++) a[i] = aa[i];
		}
		static void sort(long[] a) {
			Long[] aa = new Long[a.length];
			for (int i = 0; i < aa.length; i++) aa[i] = a[i];
			Arrays.sort(aa);
			for (int i = 0; i < aa.length; i++) a[i] = aa[i];
		}
		static void sort(double[] a) {
			Double[] aa = new Double[a.length];
			for (int i = 0; i < aa.length; i++) aa[i] = a[i];
			Arrays.sort(aa);
			for (int i = 0; i < aa.length; i++) a[i] = aa[i];
		}
		static void sort(char[] a) {
			Character[] aa = new Character[a.length];
			for (int i = 0; i < aa.length; i++) aa[i] = a[i];
			Arrays.sort(aa);
			for (int i = 0; i < aa.length; i++) a[i] = aa[i];
		}
		static long gcd(long a, long b) {
			while(b > 0) {
				long temp = b;
				b = a%b;
				a = temp;
			}
			return a;
		}
		static long lcm(long a, long b) {
			return a * (b / gcd(a,b));
		}
		static boolean isPrime(long n) {
			if (n <= 1) return false;
	        if (n <= 3) return true;
	        if (n % 2 == 0 || n % 3 == 0) return false;
	        for (long i = 5; i * i <= n; i = i + 6) {
	            if (n % i == 0 || n % (i + 2) == 0) return false;
	        }
	        return true;
		}
		static HashSet<Integer> sieve(int n) {
			boolean[] prime = new boolean[n+1];
			HashSet<Integer> res = new HashSet<>();
			for(int p = 2; p*p <= n; p++) {
				if(!prime[p]) {
					res.add(p);
					for(int i = p*p; i <= n; i+=p) prime[i] = true;
				}
			}
			return res;
		}
		static HashMap<Long, Integer> primeFactorization(long n) {
			HashMap<Long, Integer> res = new HashMap<>();
			while(n % 2 == 0) {
				res.put(2L, res.getOrDefault(2L, 0)+1);
				n/=2;
			}
			for(long i = 3; i*i <= n; i+=2) {
				while(n % i == 0) {
					res.put(i, res.getOrDefault(i, 0)+1);
					n/=i;
				}
			}
			if(n > 2) res.put(n, 1);
			return res;
		}
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		double[] nextDoubleArray(int n) {
			double[] a = new double[n];
			for (int i = 0; i < n; i++)
				a[i] = nextDouble();
			return a;
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int output = 0;
        String operations = scanner.nextLine();
        for (char op: operations.toCharArray()) {
            if (op == '+') {
                output++;
            } else {
                output--;
            }
        }
        if (output > 0) {
            System.out.println(output);
        } else {
            System.out.println(0);
        }
    }
}

import java.util.*;
import java.io.*;
public class Solution{

	public static void main(String args[])throws IOException{

		Scanner in=new Scanner(System.in);

		int n=in.nextInt();

		String action=in.next();

		int count=0;

		for(int i=0; i<n; i++)
			if(action.charAt(i)=='-')
				count-=1;
			else count+=1;

		System.out.println(Math.max(count,0));
	}
}