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

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"));
        int number =0;
        int n=0;
        String s = in.nextLine();

       for (int i = 0; i < s.length() ;i++){
            if (s.charAt(i) == ':' || s.charAt(i) == ';' ){
                n= i+1;
                while (n<s.length() && s.charAt(i) == '-'){ n++; }


                if (n<s.length() && (s.charAt(i) == '[' || s.charAt(i) == ']' || s.charAt(i) == ')' ||s.charAt(i) == '(')) number++;
             }

        }

            out.print(number);

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

  */

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

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 smile=0;
        int n=0;

        for (int i=0;i<s.length();i++){
                if (s.charAt(i) == ':' || s.charAt(i) ==';'){

                    n = i + 1;
                    while (n < s.length() && s.charAt(n) == '-' ){
                       
                        n++;
                    }
                    if (n < s.length() && ( s.charAt(n)=='(' || s.charAt(n)==')' || s.charAt(n)=='[' || s.charAt(n) ==']') )
                    smile++;
            }



        }   out.print(smile);

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

