#include <bits/stdc++.h>
using namespace std;
int n, m;
string s1, s2;
vector<string> rc;
bool vis[3000];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> s1;
  for (int i = 0; i < n; ++i)
    if (s1[i] != '*') vis[s1[i] - 'a'] = 1;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    cin >> s2;
    bool flag = true;
    for (int j = 0; j < n; ++j) {
      if (s1[j] != '*') {
        if (s2[j] != s1[j]) {
          flag = false;
          break;
        }
      } else {
        if (vis[s2[j] - 'a'] == 1) {
          flag = false;
          break;
        }
      }
    }
    if (flag) rc.push_back(s2);
  }
  int cnt = 0;
  for (int i = 0; i < 26; ++i) {
    char ch = 'a' + i;
    bool f1 = true;
    for (int j = 0; j < rc.size(); ++j) {
      bool f2 = false;
      for (int k = 0; k < n; ++k) {
        if (s1[k] == '*' && rc[j][k] == ch) {
          f2 = true;
          break;
        }
      }
      if (!f2) {
        f1 = false;
        break;
      }
    }
    if (f1 == true) cnt++;
  }
  printf("%d\n", cnt);
  return 0;
}
