#include <bits/stdc++.h>
using namespace std;
bool bz[100];
int a[26];
bool b[26], d[26];
char c, s[100];
int n, m;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf(" %c", &c);
    s[i] = c;
    if (c == '*') bz[i] = 1;
  }
  scanf("%d", &m);
  int x = m;
  while (x--) {
    for (int i = 0; i < 26; i++) b[i] = d[i] = 0;
    bool sig = 1;
    for (int i = 1; i <= n; i++) {
      scanf(" %c", &c);
      if (bz[i])
        b[c - 'a'] = 1;
      else {
        d[c - 'a'] = 1;
        if (s[i] != c) sig = 0;
      }
    }
    for (int i = 0; i < 26; i++)
      if (d[i] && b[i]) sig = 0;
    if (!sig)
      m--;
    else
      for (int i = 0; i < 26; i++) a[i] += b[i];
  }
  int sum = 0;
  for (int i = 0; i < 26; i++) sum += (a[i] == m);
  printf("%d", sum);
  return 0;
}
