#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, e, n[207];
bool w[207], w2[207];
char x[57], q[1007][57];
int main() {
  scanf("%d", &a);
  scanf("%s", x);
  scanf("%d", &b);
  for (int i = 1; i <= b; i++) scanf("%s", q[i]);
  for (int j = 1; j < 200; j++) w[j] = true;
  for (int i = 1; i <= b; i++) {
    e = 0;
    for (int j = 0; j < a; j++)
      if (x[j] != '*' && x[j] != q[i][j]) e = 1;
    for (int j = 1; j < 200; j++) w2[j] = false;
    for (int j = 0; j < a; j++)
      if (x[j] != '*') w2[x[j]] = true;
    for (int j = 0; j < a; j++)
      if (x[j] == '*' && w2[q[i][j]]) e = 1;
    if (e == 1) continue;
    for (int j = 1; j < 200; j++) n[j] = 0;
    for (int j = 0; j < a; j++)
      if (x[j] == '*') n[q[i][j]]++;
    for (int j = 1; j < 200; j++)
      if (n[j] == 0) w[j] = false;
  }
  e = 0;
  for (int j = 1; j < 200; j++)
    if (w[j]) e++;
  printf("%d\n", e);
}
