#include <bits/stdc++.h>
const int MAX_N = 55;
const int MAX_M = 1005;
char word[MAX_N], mask[MAX_M][MAX_N];
int n, m, pos[MAX_N], pos_cnt;
int know[26], book[MAX_M][26], ok[MAX_M];
int main() {
  scanf("%d", &n);
  getchar();
  scanf("%s", word);
  for (int i = 0; i < n; i++)
    if (word[i] == '*')
      pos[pos_cnt++] = i;
    else
      know[word[i] - 'a'] = 1;
  scanf("%d", &m);
  getchar();
  for (int i = 0; i < m; i++) scanf("%s", mask[i]);
  for (int i = 0; i < m; i++) {
    bool flag = true;
    for (int j = 0; j < n; j++) {
      if (word[j] != '*' && word[j] != mask[i][j]) {
        flag = false;
        break;
      }
      if (word[j] == '*') {
        if (know[mask[i][j] - 'a']) {
          flag = false;
          break;
        }
      }
    }
    if (flag) {
      ok[i] = 1;
      for (int j = 0; j < pos_cnt; j++) book[i][mask[i][pos[j]] - 'a'] = 1;
    }
  }
  int ans = 0;
  for (int i = 0; i < 26; i++) {
    bool flag = true;
    for (int j = 0; j < m; j++) {
      if (!ok[j]) continue;
      if (!book[j][i]) {
        flag = false;
        break;
      }
    }
    if (flag) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
