#include #include #include #define rep(i, l, n) for (int i = (l); i < (n); i++) using namespace std; using str = string; template using V = vector; int main(void) { int n; cin >> n; V s(n); map mp = {}; rep(i, 0, n) { cin >> s[i]; rep(j, 0, s[i].size()) { str t = ""; rep(k, 0, s[i].size()) { if (j == k) { t.push_back('.'); } else { t.push_back(s[i][k]); } } mp[t]++; } } V ans(n); rep(i, 0, n) { rep(j, 0, s[i].size()) { str t = ""; rep(k, 0, s[i].size()) { if (j == k) { t.push_back('.'); } else { t.push_back(s[i][k]); } } ans[i] += mp[t] - 1; } cout << ans[i] << endl; } return 0; }