#include <bits/stdc++.h>
using namespace std;
int eng_num = 'z' - 'a' + 1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  while (cin >> n) {
    string pattern;
    cin >> pattern;
    bool *letter_enabled = new bool[eng_num];
    for (int i = 0; i < eng_num; ++i) letter_enabled[i] = 1;
    for (int i = 0; i < n; ++i)
      if (pattern[i] != '*') letter_enabled[pattern[i] - 'a'] = 0;
    int m;
    cin >> m;
    string *word = new string[m];
    for (int i = 0; i < m; ++i) cin >> word[i];
    int *amount = new int[eng_num];
    memset(amount, 0, eng_num * sizeof(int));
    int new_m = 0;
    for (int i = 0; i < m; ++i) {
      bool *in_word = new bool[eng_num];
      memset(in_word, 0, eng_num);
      bool new_letters = true;
      for (int j = 0; j < n; ++j) {
        if (pattern[j] == '*') {
          int symb_ind = int(word[i][j]) - 'a';
          if (letter_enabled[symb_ind]) {
            in_word[symb_ind] = 1;
          } else {
            new_letters = false;
            break;
          }
        } else {
          if (pattern[j] != word[i][j]) {
            new_letters = false;
            break;
          }
        }
      }
      if (new_letters) {
        for (int i = 0; i < eng_num; ++i) {
          amount[i] += in_word[i];
        }
      } else {
        new_m++;
      }
    }
    int counter = 0;
    for (int i = 0; i < eng_num; ++i) counter += (amount[i] == m - new_m);
    cout << counter << endl;
  }
}
