#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 + 10;
map<char, int> d, t;
string s;
string know[MAXN];
int pd[MAXN];
int n, m, ans, q, x;
int main() {
  cin >> n;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != '*') x++;
  }
  if (x == s.size()) {
    cout << "0" << endl;
    return 0;
  }
  for (int i = 0; i < s.size(); i++) d[s[i]]++;
  cin >> m;
  for (int i = 1; i <= m; i++) cin >> know[i];
  for (int i = 1; i <= m; i++) {
    int cnt = 0, z = 0;
    memset(pd, 0, sizeof(pd));
    for (int j = 0; j < know[i].size(); j++) {
      if (s[j] != '*' && s[j] != know[i][j]) {
        z = 1;
        break;
      }
    }
    if (z) {
      q++;
      continue;
    }
    for (int j = 0; j < know[i].size(); j++) {
      if (d[know[i][j]] && s[j] == '*') {
        z = 1;
        break;
      }
    }
    if (z) {
      q++;
      continue;
    }
    for (int j = 0; j < know[i].size(); j++) {
      if (!pd[know[i][j] - 'a'] && !d[know[i][j]]) {
        pd[know[i][j] - 'a'] = 1;
        t[know[i][j]]++;
        z = 1;
      }
    }
    if (!z) q++;
  }
  for (int i = 0; i <= 25; i++) {
    char k = 'a' + i;
    if (!d[k] && t[k] == m - q && t[k]) ans++;
  }
  cout << ans << endl;
  return 0;
}
