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

/**
 * Created by IntelliJ IDEA.
 * User: o_242
 * Date: 28.10.2009
 * Time: 17:20:15
 * 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.nextLine();
        int num = 0;
        int r = 0;
        for (int i = 0; i < s.length(); i++)
        {
            if (s.charAt(i) == ';' || s.charAt(i) == ':')
            {
                int j = i + 1;
                while(j < s.length() - 1 && s.charAt(j) == '-')
                    j++;
                int k = j;
                if (k < s.length() - 1 && (s.charAt(k) == '(' || s.charAt(k) == ')' || s.charAt(k) == '[' || s.charAt(k) == ']'))
                {
                    num++;
                }

             }

          }
        out.println(num);
        out.close();
        in.close();
        }
    }

