#include <bits/stdc++.h>
using namespace std;
int n, m, mm;
string s;
string ss[1000 + 10], ssss[1000 + 10];
int f[200];
bool check(string ss) {
  for (int i = 0; i < n; i++)
    if ((f[ss[i]] && s[i] == '*') ||
        (s[i] != '*' && ss[i] != '*' && s[i] != ss[i]))
      return false;
  return true;
}
int main() {
  cin >> n;
  cin >> s;
  cin >> mm;
  for (int i = 0; i < mm; i++) {
    cin >> ssss[i];
  }
  memset(f, 0, sizeof(f));
  for (int i = 0; i < n; i++) f[s[i]] = 1;
  int m = 0;
  for (int i = 0; i < mm; i++) {
    if (check(ssss[i])) {
      ss[m++] = ssss[i];
    }
  }
  int ans = 0;
  for (int j = 'a'; j <= 'z'; j++)
    if (f[j] == 0) {
      int cnt = 0;
      for (int i = 0; i < m; i++) {
        string sss = ss[i];
        int dem = 0;
        for (int k = 0; k < sss.length(); k++) {
          if (f[sss[k]]) dem++;
        }
        if (dem == sss.length()) {
          cnt++;
        } else {
          for (int k = 0; k < sss.length(); k++) {
            if ((int)sss[k] == j) {
              cnt++;
              break;
            }
          }
        }
      }
      if (cnt == m) ans++;
    }
  cout << ans;
}
