#include <bits/stdc++.h>
using namespace std;
int cntBits(int n) {
  int ans = 0;
  while (n) {
    if ((n & 1)) ans++;
    n >>= 1;
  }
  return ans;
}
int getBitmask(string& a, string& b) {
  vector<bool> found(26, false);
  int ans = 0;
  for (int i = 0; i < (int)a.size(); i++) {
    if (a[i] != '*') found[(int)(a[i] - 'a')] = true;
  }
  for (int i = 0; i < (int)a.size(); i++) {
    if (a[i] == '*') {
      ans = (ans | (1 << (int)(b[i] - 'a')));
      if (found[(int)(b[i] - 'a')]) return -1;
    } else if (a[i] != b[i])
      return -1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  string s;
  cin >> n >> s >> m;
  vector<string> v(m);
  for (int i = 0; i < (int)m; i++) cin >> v[i];
  int ans = (1 << 26) - 1;
  for (int i = 0; i < (int)m; i++) {
    int r = getBitmask(s, v[i]);
    if (r != -1) {
      ans = (ans & r);
    }
  }
  cout << cntBits(ans) << endl;
  return 0;
}
