#include <bits/stdc++.h>
using namespace std;
bool esta[30];
bool possible(string s, string pass) {
  for (int j = 0; j < (int)(s.size()); j++) {
    if (pass[j] == '*') {
      if (esta[s[j] - 'a']) return false;
    } else {
      if (pass[j] != s[j]) return false;
    }
  }
  return true;
}
int main() {
  int n;
  cin >> n;
  string pass;
  cin >> pass;
  for (int i = 0; i < (int)(30); i++) esta[i] = false;
  for (int j = 0; j < (int)(n); j++) {
    if (pass[j] == '*') continue;
    esta[pass[j] - 'a'] = true;
  }
  int m;
  cin >> m;
  vector<string> pals;
  for (int j = 0; j < (int)(m); j++) {
    string t;
    cin >> t;
    pals.push_back(t);
  }
  int res = 0;
  for (char c = 'a'; c <= 'z'; c++) {
    if (!esta[c - 'a']) {
      bool vale = true;
      for (int i = 0; i < (int)(m); i++) {
        if (!possible(pals[i], pass)) continue;
        bool si = false;
        for (int j = 0; j < (int)(pass.size()); j++) {
          if (pass[j] == '*' && pals[i][j] == c) {
            si = true;
          }
        }
        if (!si) {
          vale = false;
          break;
        }
      }
      if (vale) {
        res++;
      }
    }
  }
  cout << res << endl;
}
