#include <bits/stdc++.h>
using namespace std;
string a[1004], s;
bool b[26];
int n, m, res, ans, masks[1005];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> s >> m;
  for (int i = 0; i < m; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i)
    if (s[i] >= 'a' && s[i] <= 'z') b[s[i] - 'a'] = 1;
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      if (s[j] == '*' && b[a[i][j] - 'a'] || s[j] != '*' && a[i][j] != s[j]) {
        masks[i] = 0;
        break;
      }
      if (s[j] == '*') masks[i] |= 1 << (a[i][j] - 'a');
    }
    if (masks[i]) {
      ans = masks[i];
    }
  }
  for (int i = 0; i < m; ++i)
    if (masks[i]) ans &= masks[i];
  while (ans > 0) res += ans & 1, ans >>= 1;
  printf("%d", res);
}
