#include<bits/stdc++.h>
using namespace std;

int main()
{
  //queue<char> q;
  bool flag = true;
  int cnt = 0;
  int m = 0;
  string ch;

  cin >> ch;
  for(int i = 0;i < ch.size();i++){

    if(flag && ch[i] == '(') cnt++;
    if(flag && ch[i] == ')') cnt--;
    
    if(ch[i] == '*') flag = false;
    if(!flag && ch[i] == ')'){
      if(m > cnt) continue;
      m++;
    }
  }
  cout << min(cnt, m) << endl;
  return 0;
}

