#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const int mod = 1e9 + 7;
bool vis[26];
char s[55];
int main() {
  int n;
  scanf("%d%s", &n, s);
  for (int i = 0; i < n; i++)
    if (s[i] != '*') {
      vis[s[i] - 'a'] = 1;
    }
  int m;
  scanf("%d", &m);
  int ans = (1 << 26) - 1;
  for (int i = 0; i < m; i++) {
    char t[55];
    scanf("%s", t);
    int now = 0;
    bool ok = 1;
    for (int j = 0; j < n; j++) {
      if (vis[t[j] - 'a']) {
        if (t[j] != s[j]) ok = 0;
      } else {
        if (s[j] != '*') ok = 0;
        now |= (1 << (t[j] - 'a'));
      }
    }
    if (ok) ans &= now;
  }
  int cnt = 0;
  for (int i = 0; i < 26; i++)
    if (ans & (1 << i)) cnt++;
  printf("%d\n", cnt);
  return 0;
}
