#include <bits/stdc++.h>
using namespace std;
int n, m, cont[200], saiu[200];
string s;
string v[1003];
bool good(string &x) {
  for (int i = 0; i < n; i++) {
    if (s[i] == '*' && saiu[x[i]]) return false;
  }
  for (int i = 0; i < n; i++) {
    if (s[i] == '*') continue;
    if (s[i] != x[i]) return false;
  }
  return true;
}
void calc(string &x) {
  int aux[200];
  memset(aux, 0, sizeof(aux));
  for (int i = 0; i < n; i++) {
    if (s[i] != '*') continue;
    if (!saiu[x[i]]) aux[x[i]] = 1;
  }
  for (int i = 0; i < 200; i++) cont[i] += aux[i];
}
int main() {
  cin >> n >> s;
  cin >> m;
  for (int i = 0; i < n; i++) saiu[s[i]] = 1;
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    cin >> v[i];
    if (good(v[i])) {
      calc(v[i]);
      cnt++;
    }
  }
  int ans = 0;
  for (int i = 0; i < 200; i++) {
    if (cont[i] == cnt) {
      ans++;
    }
  }
  cout << ans << endl;
}
