#include <bits/stdc++.h>
const int maxn = 55, maxm = 1005;
int n, m, a[maxn], b[maxm][maxn], ept[maxn], idx, state[maxm];
char str[maxn], book[30], imp[maxm], tpe[maxn];
int main() {
  scanf("%d", &n);
  scanf("%s", str + 1);
  for (int i = 1; i <= n; ++i) {
    if (str[i] == '*') {
      a[i] = 0;
      ept[idx++] = i;
      tpe[i] = 1;
    } else {
      a[i] = str[i] - 'a' + 1;
      book[a[i]] = 1;
    }
  }
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    scanf("%s", str + 1);
    for (int j = 1; j <= n; ++j) {
      b[i][j] = str[j] - 'a' + 1;
      if (book[b[i][j]] && tpe[j]) {
        imp[i] = 1;
      }
      if (!tpe[j] && b[i][j] != a[j]) {
        imp[i] = 1;
      }
    }
  }
  for (int i = 0; i < m; ++i) {
    if (imp[i]) {
      continue;
    }
    for (int j = 0; j < idx; ++j) {
      state[i] |= (1 << b[i][ept[j]]);
    }
  }
  int ans_st = (1 << 29) - 1;
  for (int i = 0; i < m; ++i) {
    if (imp[i]) {
      continue;
    }
    ans_st &= state[i];
  }
  int ans = 0;
  for (int i = 1; i <= 26; ++i) {
    if (ans_st >> i & 1) {
      ++ans;
    }
  }
  printf("%d\n", ans);
  return 0;
}
