#include <bits/stdc++.h>
using namespace std;
bool own(string s) {
  int a = 0;
  int b = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '(')
      a++;
    else
      b++;
    if (b > a) return false;
  }
  if (a == b) return true;
  return false;
}
int canstart(string s) {
  int a = 0;
  int b = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '(')
      a++;
    else
      b++;
    if (b > a) return 0;
  }
  return a - b;
}
int canend(string s) {
  int a = 0;
  int b = 0;
  for (int i = s.length() - 1; i >= 0; i--) {
    if (s[i] == ')')
      a++;
    else
      b++;
    if (b > a) return 0;
  }
  return a - b;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  int v1 = 0;
  vector<int> v2;
  vector<int> v3;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    if (own(s)) {
      v1++;
      continue;
    }
    int p = canstart(s);
    int q = canend(s);
    if (p != 0) {
      v2.push_back(p);
    } else if (q != 0) {
      v3.push_back(q);
    }
  }
  long long ans = 0;
  sort(v2.begin(), v2.end());
  sort(v3.begin(), v3.end());
  for (int i = 0; i < v2.size(); i++) {
    int t = v2[i];
    auto p = lower_bound(v3.begin(), v3.end(), t);
    auto q = upper_bound(v3.begin(), v3.end(), t);
    ans += (q - p);
  }
  ans += (long long)v1 * v1;
  printf("%lld", ans);
  return 0;
}
