#include <bits/stdc++.h>
using namespace std;
int n;
string s;
long long w[3][300500];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0, qwerty = n; i < qwerty; i++) {
    cin >> s;
    stack<char> st;
    st.push(s[0]);
    for (int j = 1, qwerty = s.size(); j < qwerty; j++) {
      char c = s[j];
      if (!st.empty() && c == ')' && st.top() == '(')
        st.pop();
      else
        st.push(c);
    }
    int r1 = 0, r2 = 0;
    while (!st.empty()) {
      if (st.top() == '(')
        r1++;
      else
        r2++;
      st.pop();
    }
    if (r1 && r2) continue;
    if (r1 + r2 == 0)
      w[2][0]++;
    else if (r1)
      w[0][r1]++;
    else if (r2)
      w[1][r2]++;
  }
  long long ans = w[2][0] * w[2][0];
  if (w[2][0] == 1) ans = 1;
  for (int i = 0, qwerty = 300200; i < qwerty; i++) ans += w[0][i] * w[1][i];
  cout << ans << endl;
}
