#include <bits/stdc++.h>
using namespace std;
bool flag[50];
bool pan[1010];
char s[100];
bool pp(char *ss) {
  for (int i = 0; ss[i]; i++) {
    if (s[i] != '*' && ss[i] != s[i]) return 0;
    if (s[i] == '*' && flag[ss[i] - 'a' + 1] == 1) return 0;
  }
  return 1;
}
char s2[1010][100];
int cntm[50];
bool tempv[50];
int main() {
  int n, m;
  scanf("%d", &n);
  scanf("%s", s);
  for (int i = 0; s[i]; i++) {
    if (s[i] == '*') continue;
    flag[s[i] - 'a' + 1] = 1;
  }
  scanf("%d", &m);
  int cnt = 0;
  for (int i = 1; i <= m; i++) {
    scanf("%s", s2[i]);
    pan[i] = pp(s2[i]);
    if (pan[i] == 1) cnt++;
  }
  for (int i = 1; i <= m; i++) {
    if (pan[i] == 1) {
      memset(tempv, 0, sizeof(tempv));
      for (int j = 0; s[j]; j++) {
        if (s[j] == '*' && flag[s2[i][j] - 'a' + 1] == 0 &&
            tempv[s2[i][j] - 'a' + 1] == 0) {
          tempv[s2[i][j] - 'a' + 1] = 1;
          cntm[s2[i][j] - 'a' + 1]++;
        }
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= 30; i++) {
    if (cntm[i] == cnt) {
      ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
