#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <class Ty>
Ty randint(Ty a, Ty b) {
  return uniform_int_distribution<Ty>(a, b)(rng);
}
template <class num>
inline void rd(num& x) {
  char c, neg = 0;
  while (isspace(c = getchar_unlocked()))
    ;
  if (!isdigit(c))
    neg = (c == '-'), x = 0;
  else
    x = c - '0';
  while (isdigit(c = getchar_unlocked())) x = (x << 3) + (x << 1) + c - '0';
  x = neg ? -x : x;
}
template <class Ty, class... Args>
inline void rd(Ty& x, Args&... args) {
  rd(x);
  rd(args...);
}
const int MAXN = 2e5 + 5, INF = 0x3f3f3f3f;
using bts = bitset<26>;
bts get(string const& s) {
  bts ans;
  for (char c : s) {
    if (c >= 'a' && c <= 'z') ans[c - 'a'] = 1;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int m;
  cin >> m;
  bts ex = get(s);
  bts ans = get(s);
  ans.flip();
  while (m--) {
    string t;
    cin >> t;
    bool ok = true;
    for (int i = 0; i < n; i++) {
      if (s[i] != '*' && t[i] != s[i])
        ok = false;
      else if (s[i] == '*' && ex[t[i] - 'a'])
        ok = false;
    }
    if (ok) ans &= get(t);
  }
  cout << ans.count() << "\n";
}
