#include<bits/stdc++.h>
using namespace std;
bool check(char ch1,char ch2){
if(ch1==ch2)
return true;
else if(ch1=='('&&ch2==')')
return true;
else if(ch1==')'&&ch2=='(')
return true;
return false;
}
string str;
int ans;
int main(){
scanf("%s",&str);
int len=(str.length()+1)/2;
for(int i=0;i<len;i++)
if(!check(str[i],str[str.length()-i-1]))
ans++;
printf("%d\n",ans);
return 0;
}