#include <bits/stdc++.h>
using namespace std;
template <class T1>
void deb(T1 e1) {
  cout << e1 << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
int on(int n, int pos) { return n = n | (1 << pos); }
bool check(int n, int pos) { return (bool)(n & (1 << pos)); }
int off(int n, int pos) { return n = n & ~(1 << pos); }
int toggle(int n, int pos) { return n = n ^ (1 << pos); }
int count_bit(int n) { return __builtin_popcount(n); }
int main() {
  string istr, tstr;
  int n, mask1 = 0, mask2 = (1 << 27) - 1, mask3;
  scanf("%d", &n);
  cin >> istr;
  for (int i = 0; i < n; i++) {
    if (isalpha(istr[i])) mask1 = on(mask1, istr[i] - 'a');
  }
  int m;
  bool flag;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    cin >> tstr;
    flag = 1;
    mask3 = 0;
    for (int j = 0; j < n; j++) {
      if (istr[j] == '*') {
        if (check(mask1, tstr[j] - 'a')) {
          flag = 0;
          break;
        }
        mask3 = on(mask3, tstr[j] - 'a');
      } else {
        if (istr[j] != tstr[j]) {
          flag = 0;
          break;
        }
      }
    }
    if (flag) mask2 = mask2 & mask3;
  }
  printf("%d\n", (__builtin_popcount(mask2)));
  return 0;
}
