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

public class Smile {
		
	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(new File("smile.in"));
		PrintWriter out = new PrintWriter("smile.out");
		String s = in.nextLine();
		int sum = 0;
		char [] c = s.toCharArray();
		int leng = s.length();
		int i = 0;
		while(i < leng){
			if ((c[i] == ':' )||(c[i] == ';' )){
				if (i == leng-1){
					break;}
				i++;
				if (c[i] == '-' ){
					while (c[i] == '-' ){
						if (i == leng-1){
							break;}
						i++;
					}
					if ((c[i] == ')' )||(c[i] == '(' )||(c[i] == ']' )||(c[i] == '[' )){
						
						sum++;
					}
				
				}else{
					if ((c[i] == ')' )||(c[i] == '(' )||(c[i] == ']' )||(c[i] == '[' )){
						
						sum++;
					}
								
				}
			}
			i++;
		}
		out.print(sum);
		in.close();
		out.close();
		
	}

}
