#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  string second;
  cin >> second;
  map<char, int> ma;
  for (int i = 0; i < n; i++) {
    if (second[i] != '*') {
      ma[second[i]]++;
    }
  }
  long long m;
  cin >> m;
  vector<string> v(m), vv;
  for (int i = 0; i < m; i++) {
    cin >> v[i];
    int j;
    for (j = 0; j < n; j++) {
      if (second[j] == '*') {
        if (ma.count(v[i][j])) break;
      } else if (second[j] != v[i][j]) {
        break;
      }
    }
    if (j == n) {
      vv.push_back(v[i]);
    }
  }
  map<char, int> mm;
  for (int i = 0; i < vv.size(); i++) {
    map<char, int> temp;
    for (int j = 0; j < n; j++)
      if (second[j] == '*') {
        temp[vv[i][j]]++;
      }
    for (auto a : temp) {
      mm[a.first]++;
    }
  }
  long long ans = 0;
  for (auto a : mm) {
    if (a.second == vv.size()) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
