#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
bitset<50> str[N][26], t[26];
bool should[26];
bitset<26> will;
char s[N];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  will.set();
  for (int c = 0; c < 26; ++c) {
    for (int i = 0; i < n; ++i) {
      if (s[i] == (char)('a' + c)) {
        t[c][i] = 1;
        should[c] = 1;
        will[c] = 0;
      }
    }
  }
  int m;
  scanf("%d", &m);
  for (int j = 0; j < m; ++j) {
    scanf("%s", s);
    bool gg = 0;
    for (int c = 0; c < 26; ++c) {
      for (int i = 0; i < n; ++i) {
        if (s[i] == (char)('a' + c)) {
          str[j][c][i] = 1;
        }
      }
      if (should[c] && str[j][c] != t[c]) gg = 1;
    }
    if (gg) continue;
    for (int c = 0; c < 26; ++c)
      if (!str[j][c].count()) will[c] = 0;
  }
  printf("%d\n", (int)will.count());
}
