#include <bits/stdc++.h>
using namespace std;
const int RNG = 100003;
const int RNGT = RNG * 4;
const int MOD1 = 1e9 + 7;
const int MOD2 = 1e9 + 87;
const double pi = 2 * acos(0.0);
inline int _Int() {
  int x;
  scanf("%d", &x);
  return x;
}
inline long long _LLi() {
  long long x;
  scanf("%lld", &x);
  return x;
}
void pruts() {
  puts("-1");
  exit(EXIT_SUCCESS);
}
int dirX[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dirY[] = {0, 1, 0, -1, 1, -1, -1, 1};
int rX[] = {1, 1, 2, 2, -1, -1, -2, -2};
int rY[] = {2, -2, 1, -1, 2, -2, 1, -1};
template <class T>
T tri_Area(T x1, T y1, T x2, T y2, T x3, T y3) {
  return abs(x1 * (y2 - y3) - y1 * (x2 - x3) + (x2 * y3 - x3 * y2));
};
template <class T>
T Distance(T x1, T y1, T x2, T y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
};
template <class T>
T bigMod(T n, T p, T m) {
  if (p == 0) return 1;
  if (p & 1) return (n * bigMod(n, p - 1, m)) % m;
  T x = bigMod(n, p / 2, m);
  return (x * x) % m;
};
int Case;
int sset(int N, int pos) { return N = N | (1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
map<char, int> M;
string poly[1003], carp[1003];
int N[500];
void Hunger() {
  int n = _Int();
  string word;
  cin >> word;
  vector<int> idx;
  for (int i = 0; i < n; i++) {
    if (word[i] == '*')
      idx.push_back(i);
    else
      M[word[i]] = 1;
  }
  int m = _Int();
  for (int i = 0; i < m; i++) cin >> poly[i];
  int id = 0;
  int sz = idx.size();
  for (int i = 0; i < m; i++) {
    int f = 0, g = 0;
    for (int j = 0; j < n; j++) {
      if (word[j] == '*') continue;
      if (word[j] != poly[i][j]) g = 1;
    }
    for (int j = 0; j < sz; j++) {
      if (M[poly[i][idx[j]]]) {
        f = 1;
        break;
      }
    }
    if (!f && !g) carp[id++] = poly[i];
  }
  int ans = 0;
  for (int i = 0; i < sz; i++) {
    for (char a = 'a'; a <= 'z'; a++) {
      int cnt = 0;
      if (M[a]) continue;
      for (int j = 0; j < id; j++) {
        for (int k = 0; k < sz; k++) {
          if (a == carp[j][idx[k]]) {
            cnt++;
            break;
          }
        }
      }
      if (cnt == id) ans++;
      M[a] = 1;
    }
  }
  cout << ans << endl;
}
int main() {
  Hunger();
  return 0;
}
