#include <cstdio>
#include <cctype>
#include <cassert>
#include <string>

int parse(const std::string& s, size_t& i) {
  if (s[i] == '*') {
    ++i;
    return 0;
  }

  assert(s[i] == '(');
  ++i;
  int res = 0;
  while (s[i] != ')') {
    if (s[i] == '*') {
      res = 1;
      ++i;
    } else {
      int tmp = parse(s, i);
      if (tmp) res += ++tmp;
    }
  }
  assert(s[i] == ')');
  ++i;
  return res;
}

int main() {
  char buf[128];
  scanf("%s", buf);
  std::string s = buf;
  size_t i = 0;

  while (i != s.length()) {
    int res = parse(s, i);
    if (res) return !printf("%d\n", res);
  }
  puts("0");
}

