#include <bits/stdc++.h>
using namespace std;
int strl, n;
string strtebak, str[1010];
int main() {
  cin >> strl;
  cin >> strtebak;
  cin >> n;
  bool boltab[40];
  for (int i = 0; i < 40; i++) boltab[i] = 1;
  bool hurufTebak[40];
  memset(hurufTebak, 0, sizeof(hurufTebak));
  for (int i = 0; i < strtebak.length(); i++) hurufTebak[strtebak[i] - 'a'] = 1;
  bool cek2 = 0;
  for (int i = 0; i < n; i++) {
    cin >> str[i];
    bool cek1 = 0;
    for (int j = 0; j < str[i].length(); j++) {
      if (hurufTebak[str[i][j] - 'a'] == 0) {
        cek1 = 1;
        break;
      }
    }
    if (!cek1) continue;
    cek1 = 0;
    for (int j = 0; j < str[i].length(); j++) {
      if (strtebak[j] != '*' && str[i][j] != strtebak[j]) {
        cek1 = 1;
        break;
      }
      if (strtebak[j] == '*' && hurufTebak[str[i][j] - 'a'] == 1) {
        cek1 = 1;
        break;
      }
    }
    if (cek1) continue;
    bool bolstr[40];
    memset(bolstr, 0, sizeof(bolstr));
    for (int j = 0; j < str[i].length(); j++) {
      if ('a' <= str[i][j] && str[i][j] <= 'z') bolstr[str[i][j] - 'a'] = 1;
    }
    for (int j = 0; j < 40; j++) boltab[j] = boltab[j] & bolstr[j];
    cek2 = 1;
  }
  if (!cek2) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < strtebak.length(); i++) {
    if ('a' <= strtebak[i] && strtebak[i] <= 'z') boltab[strtebak[i] - 'a'] = 0;
  }
  int ans = 0;
  for (int i = 0; i < 40; i++)
    if (boltab[i]) ans++;
  cout << ans << endl;
  return 0;
}
