#include <bits/stdc++.h>
using namespace std;
const int maxn = 1009;
char s[maxn][55], t[maxn];
int vis[maxn][55], flag[maxn], cnt, n, m, check, ans;
int main() {
  scanf("%d%s", &n, &t);
  for (int i = 0; i <= n - 1; i++)
    if (t[i] != '*') flag[t[i] - 'a'] = 1;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%s", &s[i]);
    check = 1;
    for (int j = 0; j <= n - 1; j++)
      if (t[j] != '*' && s[i][j] != t[j])
        check = 0;
      else if (t[j] == '*' && flag[s[i][j] - 'a'])
        check = 0;
    if (!check) continue;
    cnt++;
    vis[i][50] = 1;
    for (int j = 0; j <= n - 1; j++) vis[i][s[i][j] - 'a'] = 1;
  }
  if (!cnt) {
    puts("0");
    return 0;
  }
  for (int i = 0; i <= 25; i++) {
    if (flag[i]) continue;
    check = 1;
    for (int j = 1; j <= m; j++)
      if (vis[j][50] && !vis[j][i]) check = 0;
    ans += check;
  }
  printf("%d\n", ans);
  return 0;
}
