#include <bits/stdc++.h>
using namespace std;
bool check(string &w, string &s, map<char, int> &cnt) {
  int used['z' - 'a' + 1] = {};
  int arr['z' - 'a' + 1] = {};
  for (int i = 0; i < w.size(); ++i) {
    if (w[i] != '*') {
      used[w[i] - 'a'] = 1;
    }
  }
  for (int i = 0; i < w.size(); ++i) {
    if (w[i] == '*') {
      if (used[s[i] - 'a']) {
        return false;
      }
      arr[s[i] - 'a'] += 1;
    } else if (w[i] != s[i]) {
      return false;
    }
  }
  for (int i = 0; i < 'z' - 'a' + 1; ++i) {
    if (arr[i]) {
      cnt['a' + i] += 1;
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  string w;
  cin >> w;
  map<char, int> cnt;
  int k = 0;
  int m;
  cin >> m;
  string s;
  for (int i = 0; i < m; ++i) {
    cin >> s;
    if (check(w, s, cnt)) {
      k++;
    }
  }
  int ans = 0;
  for (auto p : cnt) {
    if (p.second == k) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
