import java.util.Scanner;
public class ParenthesesScore {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        // check for invalid input
        if (!s.matches("[()]+")) {
            System.out.println("Invalid input");
            return;
        }

        int score = 0, depth = 0;

        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);

            if (c == '(') {
                depth++;
            } else {
                depth--;
                if (s.charAt(i - 1) == '(') {
                    score += 1 << depth; // 2^depth
                }
            }
        }

        System.out.println(score);
    }
}