#include <bits/stdc++.h>
using namespace std;
char hidden[64];
int app[26];
int main(void) {
  int ans = (1 << 26) - 1;
  int n, m;
  scanf("%d", &n);
  scanf("%s", hidden);
  for (char *p = hidden; 0 != *p; p++)
    if ('*' != *p) app[*p - 'a'] = 1;
  scanf("%d", &m);
  int ok_cnt = 0;
  while (m--) {
    int cur = 0;
    int ok = 1;
    char candidate[64];
    scanf("%s", candidate);
    for (char *p = candidate; 0 != *p; p++) {
      if ('*' == hidden[p - candidate]) {
        cur |= (1 << (*p - 'a'));
        if (app[*p - 'a']) {
          cur = (1 << 26) - 1;
          ok = 0;
          break;
        }
      } else if (hidden[p - candidate] != *p) {
        cur = (1 << 26) - 1;
        ok = 0;
        break;
      }
    }
    ok_cnt += ok;
    ans &= cur;
  }
  int cnt = 0;
  while (ans) {
    if (ans & 1) cnt++;
    ans >>= 1;
  }
  printf("%d\n", ok_cnt ? cnt : 0);
  return 0;
}
