#include <bits/stdc++.h>
using namespace std;
int n, x, k, g[1010], use[1010], m, nr, u[1010];
string s, st[1010];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  cin >> s;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> st[i];
  for (int i = 0; i < s.size(); i++) use[s[i]] = 1;
  nr = n;
  for (int i = 1; i <= n; i++) {
    int ok = 1;
    for (int j = 0; j < st[i].size(); j++) {
      if (s[j] != '*' && st[i][j] != s[j]) ok = 0;
      if (s[j] == '*' && use[st[i][j]]) ok = 0;
    }
    if (ok == 0) {
      nr--;
      continue;
    }
    memset(u, 0, 300 * 4);
    for (int j = 0; j < st[i].size(); j++) {
      if (s[j] == '*' && u[st[i][j]] == 0) g[st[i][j]]++, u[st[i][j]] = 1;
    }
  }
  int ans = 0;
  for (int i = 'a'; i <= 'z'; i++)
    if (g[i] == nr) ans++;
  cout << ans << '\n';
}
