#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x);
    x = (x * x);
    y /= 2;
  }
  return res;
}
long long mulmod(long long x, long long y) {
  long long res = 0;
  while (y > 0) {
    if (y & 1) res = (res + x) % 998244353;
    x = (2 * x) % 998244353;
    y /= 2;
  }
  return res;
}
bool prime[1000001];
long long fact[1000001];
vector<long long> p;
void sieve() {
  for (long long i = 2; i < 1000001; i++) prime[i] = 1;
  for (long long i = 2; i < 1000001; i++) {
    if (prime[i]) {
      p.push_back(i);
      for (long long j = i * i; j < 1000001; j += i) prime[j] = false;
    }
  }
}
long long phi(long long n) {
  long long result = n;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      result -= (result) / i;
    }
  }
  if (n > 1) result -= result / n;
  return result;
}
bool compare_string(pair<string, long long> a, pair<string, long long> b) {
  if (a.first.size() < b.first.size())
    return true;
  else if (a.first.size() == b.first.size()) {
    if (a.first < b.first)
      return true;
    else
      return false;
  } else
    return false;
}
void bfs(vector<long long> adj[], long long o, long long n, long long dp[]) {
  queue<long long> q;
  q.push(o);
  dp[o] = 0;
  vector<bool> vis(n + 1, false);
  vis[o] = true;
  while (!q.empty()) {
    long long a = q.front();
    q.pop();
    for (long long i = 0; i < adj[a].size(); i++) {
      if (!vis[adj[a][i]]) {
        vis[adj[a][i]] = true;
        q.push(adj[a][i]);
        dp[adj[a][i]] = dp[a] + 1;
      }
    }
  }
}
long long modInv(long long a) { return power(a, 998244353 - 2); }
long long ncr(long long n, long long r) {
  long long b = modInv(fact[n - r]);
  long long c = modInv(fact[r]);
  long long a = fact[n] * b;
  a %= 1000000007;
  a *= c;
  a %= 1000000007;
  return a;
}
void dfs(long long i, vector<long long> adj[], bool vis[], long long &t) {
  vis[i] = true;
  for (auto it : adj[i]) {
    if (!vis[it]) {
      dfs(it, adj, vis, ++t);
    }
  }
}
void dfs(vector<long long> adj[], long long &m, long long x,
         vector<bool> &vis) {
  vis[x] = 1;
  m = max(m, x);
  for (auto it : adj[x]) {
    if (!vis[it]) {
      dfs(adj, m, it, vis);
    }
  }
}
long long inline en(char ch) {
  if (ch == 'R')
    return 0;
  else if (ch == 'G')
    return 1;
  return 2;
}
int32_t main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed;
  long long n;
  cin >> n;
  string str;
  cin >> str;
  vector<bool> vis(26, 0);
  vector<long long> idx;
  for (long long i = 0; i < str.size(); i++) {
    if (str[i] >= 'a' && str[i] <= 'z') {
      vis[str[i] - 'a'] = 1;
    } else
      idx.push_back(i);
  }
  long long m, tot = 0;
  cin >> m;
  vector<long long> lett(26, 0);
  for (long long i = 0; i < m; i++) {
    string tmp;
    cin >> tmp;
    bool flag = 0;
    vector<bool> v(26, 0);
    for (auto it : idx) {
      if (vis[tmp[it] - 'a']) {
        flag = 1;
        break;
      }
    }
    for (long long i = 0; i < tmp.size(); i++) {
      if (str[i] != '*' && str[i] != tmp[i]) {
        flag = 1;
        break;
      }
    }
    if (flag) continue;
    tot++;
    for (auto it : idx) {
      if (!v[tmp[it] - 'a']) {
        lett[tmp[it] - 'a']++;
        v[tmp[it] - 'a'] = 1;
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 26; i++) {
    if (lett[i] == tot) ans++;
  }
  cout << ans << "\n";
}
