#include <bits/stdc++.h>
using namespace std;
long long int t[1005];
set<long long int> v[30];
int main() {
  ios_base::sync_with_stdio(0);
  long long int n;
  cin >> n;
  string s;
  cin >> s;
  set<char> st;
  for (long long int i = 0; i < n; i++) {
    st.insert(s[i]);
  }
  long long int m;
  cin >> m;
  char ar[m][n];
  for (long long int i = 0; i < m; i++) {
    for (long long int j = 0; j < n; j++) cin >> ar[i][j];
  }
  long long int tm = m;
  for (long long int i = 0; i < m; i++) {
    for (long long int j = 0; j < n; j++) {
      if (s[j] == '*') {
        if (st.find(ar[i][j]) != st.end()) t[i] = 1;
      } else {
        if (s[j] != ar[i][j]) t[i] = 1;
      }
    }
  }
  for (long long int i = 0; i < m; i++) {
    if (t[i]) {
      tm--;
      continue;
    }
    for (long long int j = 0; j < n; j++) {
      if (s[j] == '*') {
        v[ar[i][j] - 97].insert(i);
      }
    }
  }
  if (tm == 0) {
    cout << "0\n";
    return 0;
  }
  long long int cnt = 0;
  for (long long int i = 0; i < 26; i++) {
    if (st.find((char)(i + 97)) != st.end()) continue;
    if (v[i].size() == tm) cnt++;
  }
  cout << cnt << endl;
  return 0;
}
