#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> mp;
vector<pair<int, int>> v;
void fx(string &s) {
  stack<char> st;
  for (int i = 0; i < s.size(); i++) {
    if (st.size() == 0)
      st.push(s[i]);
    else {
      char tmp = st.top();
      if (tmp == '(' && s[i] == ')')
        st.pop();
      else
        st.push(s[i]);
    }
  }
  int l = 0, r = 0;
  while (st.size() != 0) {
    char tmp = st.top();
    if (tmp == '(')
      l++;
    else
      r++;
    st.pop();
  }
  v.push_back(make_pair(l, r));
  mp[make_pair(l, r)]++;
}
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    fx(s);
  }
  long long int ans = 0;
  for (auto p : v) {
    int l = p.first;
    int r = p.second;
    if (r == 0) {
      auto it = mp.find(make_pair(r, l));
      if (it != mp.end()) ans += (long long int)it->second;
    }
  }
  printf("%lld", ans);
  return 0;
}
