#include using namespace std; int main(){ int n; cin >> n; vector s(n); unordered_set st = {}; for(auto& ss : s){ cin >> ss; st.insert(ss); } for(auto ss: s){ int ans = 0; for(size_t i = 0; i < ss.size(); ++i){ char c = ss[i]; for(--ss[i]; ss[i] >= 'a'; --ss[i]){ ans += (st.find(ss) != st.end()); } ss[i] = c; for(++ss[i]; ss[i] <= 'z'; ++ss[i]){ ans += (st.find(ss) != st.end()); } ss[i] = c; } cout << ans << endl; } return 0; }