#include <bits/stdc++.h>
using namespace std;
bool kiem(char x, string y) {
  for (long i = 0; i < y.size(); i++)
    if (y[i] == x) return true;
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long n;
  vector<bool> s;
  string o, tmp;
  cin >> n;
  cin.ignore(1);
  getline(cin, o);
  s.assign('z' - 'a' + 1, false);
  for (long i = 0; i < o.size(); i++) {
    if (o[i] != '*') {
      s[o[i] - 'a'] = true;
    }
  }
  vector<string> st;
  cin >> n;
  cin.ignore(1);
  bool ok = true;
  for (long i = 0; i < n; i++) {
    ok = true;
    getline(cin, tmp);
    for (long j = 0; j < tmp.size(); j++)
      if (o[j] == '*') {
        if (s[tmp[j] - 'a']) {
          ok = false;
          break;
        }
      } else if (o[j] != tmp[j]) {
        ok = false;
        break;
      }
    if (ok) st.push_back(tmp);
  }
  long kq = 0;
  for (char k = 'a'; k <= 'z'; k++) {
    if (!s[k - 'a']) {
      long dem = 0;
      for (long xau = 0; xau < st.size(); xau++) dem += kiem(k, st[xau]);
      if (dem == st.size()) kq++;
    }
  }
  cout << kq;
}
