#include <bits/stdc++.h>
using namespace std;
int n, m, m2, dem;
string s;
vector<string> a;
vector<int> c;
bool b[30];
int d[30];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    char u;
    cin >> u;
    s += u;
    if (u != '*') {
      b[u - 96] = true;
    } else {
      dem++;
    }
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    string s1, s2;
    cin >> s1;
    for (int j = 0; j < s.length(); j++) {
      if (s[j] == '*') {
        s2 += s1[j];
        s1[j] = '*';
      }
    }
    if (s == s1) {
      bool check = false;
      for (int j = 0; j < s2.length(); j++) {
        int x = s2[j] - 96;
        if (b[s2[j] - 96] == true) {
          check = true;
          break;
        }
      }
      if (check == false) {
        sort(s2.begin(), s2.end());
        a.push_back(s2);
      }
    }
  }
  for (int i = 0; i < a.size(); i++) {
    string s1 = a[i];
    dem = 1;
    while (dem < s1.length()) {
      if (s1[dem] == s1[dem - 1]) {
        s1.erase(dem, 1);
      } else {
        dem++;
      }
    }
    a[i] = s1;
    for (int j = 0; j < s1.length(); j++) {
      d[s1[j] - 96]++;
    }
  }
  dem = 0;
  for (int i = 1; i <= 26; i++) {
    if (d[i] == a.size()) {
      dem++;
    }
  }
  cout << dem;
}
