#include <bits/stdc++.h>
using namespace std;
const int MAXN = 0;
string RemoveU(string s) {
  string t;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'u')
      t = t + 'o' + 'o';
    else
      t = t + s[i];
  }
  return t;
}
string RemoveKH(string s) {
  string t;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'h') {
      while (t.size() > 0 && t[t.size() - 1] == 'k') t.pop_back();
      t = t + 'h';
    } else {
      t = t + s[i];
    }
  }
  return t;
}
string NormalForm(string s) {
  s = RemoveU(s);
  s = RemoveKH(s);
  return s;
}
set<string> names;
int main() {
  int N;
  cin >> N;
  string s;
  getline(cin, s);
  for (int i = 1; i <= N; i++) {
    getline(cin, s);
    string t = NormalForm(s);
    names.insert(t);
  }
  cout << names.size() << endl;
  return 0;
}
