#include <bits/stdc++.h>
int main() {
  int n, i, j, k;
  scanf("%d", &n);
  char a[100];
  scanf("%s", a);
  int m;
  scanf("%d", &m);
  char b[1001][52];
  for (i = 0; i < m; i++) scanf("%s", b[i]);
  int count[1001][52];
  for (i = 0; i < m; i++)
    for (j = 0; j < 51; j++) count[i][j] = 0;
  int cnt = 0, val[1001];
  for (i = 0; i < m; i++) {
    val[i] = 1;
    for (j = 0; j < n; j++) {
      if (a[j] != b[i][j] && a[j] != '*') {
        val[i] = 0;
        break;
      }
    }
    if (val[i] == 1) {
      for (j = 0; j < n; j++) {
        if (a[j] != '*') {
          for (k = 0; k < n; k++) {
            if (b[i][k] == a[j] && k != j) {
              if (a[k] != a[j]) val[i] = 0;
            }
          }
        }
      }
    }
    if (val[i] == 1) {
      cnt++;
      for (j = 0; j < n; j++) {
        if (a[j] == '*') {
          count[i][b[i][j] - 'a'] = 1;
        }
      }
    }
  }
  int ans[50] = {0}, q = 0;
  for (i = 0; i < 30; i++) {
    for (j = 0; j < m; j++) ans[i] += count[j][i];
  }
  for (i = 0; i < 30; i++) {
    if (ans[i] == cnt) q++;
  }
  printf("%d\n", q);
  return 0;
}
