#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
using vi = std::vector<int>;
using vll = std::vector<ll>;
using vull = std::vector<ull>;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n;
  string in, candidate;
  cin >> in >> m;
  vector<bool> revealed(26, false);
  vector<bool> possible(26, true);
  vector<bool> cur(26, false);
  for (int i = 0; i < n; ++i) {
    if (in[i] != '*') {
      revealed[in[i] - 'a'] = true;
      possible[in[i] - 'a'] = false;
    }
  }
  auto intersect = [&]() {
    for (int i = 0; i < (int)possible.size(); ++i) {
      possible[i] = possible[i] && cur[i];
    }
  };
  auto check = [&]() {
    bool ignore = false;
    cur.assign(26, false);
    for (int i = 0; i < n; ++i) {
      int e = candidate[i] - 'a';
      if (in[i] != candidate[i]) {
        if (in[i] != '*') {
          ignore = true;
          break;
        } else {
          if (revealed[e]) {
            ignore = true;
            break;
          } else {
            cur[e] = true;
          }
        }
      }
    }
    if (!ignore) {
      intersect();
    }
  };
  for (int i = 0; i < m; ++i) {
    cin >> candidate;
    check();
  }
  cout << count(possible.begin(), possible.end(), true) << endl;
}
