#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  string str[10000];
  char ch[10000];
  map<string, int> M;
  map<char, int> G;
  int num = 0;
  for (int i = 0; i < n; i++) {
    cin >> str[i];
    int len = str[i].length();
    G.clear();
    int tot = 0;
    for (int j = 0; j < len; j++) {
      if (str[i][j] >= 'a' && str[i][j] <= 'z')
        str[i][j] = str[i][j] - 'a' + 'A';
      if (G[str[i][j]] == 0) {
        ch[tot++] = str[i][j];
        G[str[i][j]] = 1;
      }
    }
    ch[tot] = '\0';
    sort(ch, ch + tot);
    if (M[ch] == 0) {
      M[ch] = 1;
      num++;
    }
  }
  printf("%d\n", num);
}
