#include <bits/stdc++.h>
using namespace std;
int ans, cl, qm;
string s;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> s;
  for (long long i = 0; i < (long long)s.size(); i++) {
    stack<int> op;
    cl = 0;
    qm = 0;
    for (long long j = i; j < (long long)s.size(); j++) {
      if (s[j] == '(')
        op.push(j);
      else if (s[j] == ')' && !op.empty())
        op.pop();
      else if (s[j] == ')' && cl) {
        cl--;
        qm++;
      } else if (s[j] == ')' && qm)
        qm--;
      else if (s[j] == ')')
        break;
      else if (!op.empty()) {
        op.pop();
        cl++;
      } else
        qm++;
      if (op.empty() && ((qm + 1) & 1)) ans++;
    }
  }
  cout << ans;
  return 0;
}
