#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  int main_cont = count(str.begin(), str.end(), '*');
  set<char> letters;
  int m;
  cin >> m;
  vector<string> b(m);
  for (int i = 0; i < m; i++) cin >> b[i];
  vector<int> pos;
  for (int i = 0; i < str.length(); i++) {
    if (str[i] != '*')
      letters.insert(str[i]);
    else
      pos.push_back(i);
  }
  vector<string> a;
  for (int i = 0; i < m; i++) {
    bool flay = true, slay = true;
    for (int j = 0; j < str.length(); j++) {
      if (str[j] != '*' && str[j] != b[i][j]) {
        slay = false;
        break;
      }
    }
    for (int j = 0; j < pos.size(); j++) {
      if (letters.find(b[i][pos[j]]) != letters.end()) {
        flay = false;
        break;
      }
    }
    if (flay && slay) a.push_back(b[i]);
  }
  m = a.size();
  int cont = 0;
  int t = 0;
  for (int j = 0; j < m; j++) {
    int itr = 0;
    for (int i = 0; i < pos.size(); i++) {
      if (letters.find(a[j][pos[i]]) != letters.end()) itr++;
    }
    if (itr < main_cont) {
      t = j;
      break;
    }
  }
  for (int i = 0; i < pos.size(); i++) {
    char c = a[t][pos[i]];
    if (letters.find(c) == letters.end()) {
      bool flag = true;
      for (int j = t; j < m; j++) {
        if (count(a[j].begin(), a[j].end(), c) == 0) {
          flag = false;
          break;
        }
      }
      if (flag) {
        cont++;
        letters.insert(c);
      }
    }
  }
  cout << cont << endl;
  return 0;
}
