#include <bits/stdc++.h>
using namespace std;
string a[1005];
set<char> done;
vector<set<long long> > v;
void solve() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long m;
  cin >> m;
  for (long long i = 0; i < m; i++) cin >> a[i];
  for (auto i : s)
    if (i != '*') done.insert(i);
  for (long long i = 0; i < m; i++) {
    set<long long> st;
    long long f = 0;
    for (long long j = 0; j < (long long)s.size(); j++) {
      if (s[j] == '*') {
        if (done.find(a[i][j]) != done.end()) f = 1;
        st.insert(a[i][j]);
      } else {
        if (s[j] != a[i][j]) f = 1;
      }
    }
    if (!f) v.push_back(st);
  }
  if ((long long)v.size() == 0)
    cout << 0;
  else {
    set<long long> ans = v[0], cpy = ans;
    for (auto si : v) {
      for (auto i : ans) {
        if (si.find(i) == si.end()) cpy.erase(i);
      }
      ans = cpy;
    }
    cout << (long long)ans.size();
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
