#include <bits/stdc++.h>
using namespace std;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, 1, 0, -1};
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const double EPS = 1e-5;
vector<bool> rvl(30);
bool match(string a, string b) {
  for (int i = 0; i < a.length(); i++)
    if (!(a[i] == '*' && !rvl[b[i] - 'a'] || a[i] == b[i])) return false;
  return true;
}
int n;
string word;
vector<string> ch;
bool valid(char c) {
  for (int i = 0; i < ch.size(); i++) {
    bool f = false;
    for (int j = 0; j < ch[i].size(); j++) {
      if (word[j] == '*' && ch[i][j] == c) {
        f = true;
        break;
      }
    }
    if (!f) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n;
  cin >> word;
  for (int i = 0; i < word.length(); i++)
    if (word[i] != '*') rvl[word[i] - 'a'] = true;
  int x;
  cin >> x;
  for (int i = 0; i < x; i++) {
    string s;
    cin >> s;
    if (match(word, s)) ch.push_back(s);
  }
  int r = 0;
  for (char c = 'a'; c <= 'z'; c++)
    if (valid(c)) r++;
  cout << r << endl;
  cin.ignore(), cin.get();
}
