import java.util.Scanner;
import java.io.File;
import java.io.PrintWriter;

/**
 * Created by IntelliJ IDEA.
 * User: m08sds
 * Date: 28.10.2009
 * Time: 17:25:45
 * To change this template use File | Settings | File Templates.
 */
public class smile {
    public static void main (String [] args) throws Exception {
        Scanner in = new Scanner( new File("smile.in"));
        PrintWriter out = new PrintWriter(new File("smile.out"));
        String s = in.next();
        int i=0;
        int m=0;
        int n=s.length();
        for (i=0;i<n;i++) {
            char a = s.charAt(i);
            if (a==';'|| a==':') {
                int j = i + 1;
                while ( s.charAt(j) == '-' )
                    j++;
                if ( s.charAt(j) ==')'||s.charAt(j)==']'||s.charAt(j)=='('||s.charAt(j)=='[') {
                  m = m+1;
                }
            }
        }
        out.println(m);
        out.close();
        in.close();
    }
}
