#include <bits/stdc++.h>
using namespace std;
struct Solution {
  void solve() {
    int n;
    cin >> n;
    string str;
    cin >> str;
    set<char> q;
    for (int i = 0; i < n; ++i) {
      if (str[i] != '*') {
        q.insert(str[i]);
      }
    }
    int m;
    cin >> m;
    set<string> w;
    for (int i = 0; i < m; ++i) {
      string tmp;
      cin >> tmp;
      bool is = true;
      for (int j = 0; is && j < n; ++j) {
        if (str[j] != '*' && tmp[j] != str[j]) is = false;
      }
      if (is) {
        for (int j = 0; is && j < n; ++j) {
          if (str[j] == '*' && q.count(tmp[j])) {
            is = false;
          }
        }
      }
      if (is) w.insert(tmp);
    }
    map<char, int> u;
    for (auto& x : w) {
      set<char> t;
      for (int j = 0; j < n; ++j) {
        if (str[j] == '*') t.insert(x[j]);
      }
      for (auto& y : t) {
        ++u[y];
      }
    }
    int cnt = w.size();
    int ans = 0;
    for (auto& x : u) {
      if (x.second == cnt) {
        ++ans;
      }
    }
    cout << ans << endl;
  }
};
int main(void) {
  Solution().solve();
  return 0;
}
