#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using vi = vector<lli>;
using pii = pair<lli, lli>;
using vvi = vector<vi>;
using vii = vector<pii>;
using vvii = vector<vii>;
template <class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& v) {
  return s << '(' << get<0>(v) << ',' << get<1>(v) << ')';
}
template <class A, class B>
ostream& operator<<(ostream& s, tuple<A, B> const& v) {
  return s << '(' << get<0>(v) << ',' << get<1>(v) << ')';
}
template <class A, class B, class C>
ostream& operator<<(ostream& s, tuple<A, B, C> const& v) {
  return s << '(' << get<0>(v) << ',' << get<1>(v) << ',' << get<2>(v) << ')';
}
template <class A>
ostream& print_col(ostream& s, A const& v);
template <class A>
ostream& operator<<(ostream& s, vector<A> const& v) {
  return print_col(s, v);
}
template <class A>
ostream& operator<<(ostream& s, set<A> const& v) {
  return print_col(s, v);
}
template <class A, class B>
ostream& operator<<(ostream& s, map<A, B> const& v) {
  return print_col(s, v);
}
template <class A>
ostream& print_col(ostream& s, A const& v) {
  s << '[';
  for (auto const& x : v) s << x << ' ';
  return s << ']';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int m;
  cin >> m;
  bitset<256> kn;
  for (lli i = 0; i < (n); ++i) kn[s[i]] = 1;
  auto ok = ~kn;
  for (lli q_ = 0; q_ < (m); ++q_) {
    string t;
    cin >> t;
    bitset<256> th = 0;
    for (lli i = 0; i < (n); ++i)
      if (s[i] != '*' && s[i] != t[i]) goto l1;
    for (lli i = 0; i < (n); ++i)
      if (s[i] == '*' && kn[t[i]]) goto l1;
    for (lli i = 0; i < (n); ++i)
      if (s[i] == '*') th[t[i]] = 1;
    ok &= th;
  l1:;
  }
  cout << ok.count() << endl;
  return 0;
}
