/**
 * Created by IntelliJ IDEA.
 * User: m09aaa
 * Date: 28.10.2009
 * Time: 17:15:15
 * To change this template use File | Settings | File Templates.
 */
import java.util.*;
import java.io.*;

public class zadacha1 {
    public static void main  ( String[] args ) throws Exception
    {
        int kol=0;
        Scanner in=new Scanner(new File("smile.in"));
        String s=in.nextLine();
        int i=0;
       while(i<s.length()-1)
        {
             if (s.charAt(i)==':'||s.charAt(i)==';')
             {
                 i++;
                 while (s.charAt(i)=='-'&&i<s.length()-1)
                 {
                     i++;
                 }
                 if (s.charAt(i)=='('||s.charAt(i)==')'||s.charAt(i)=='['||s.charAt(i)==']')
                 {
                     kol++;
                 }
             }
            i++;
        }
        PrintWriter out=new PrintWriter (new File("smile.out"));
        out.println(kol);
        out.close();
    }
}
