#include <bits/stdc++.h>
using namespace std;
namespace fastIO {
bool IOerror = 0;
inline char nc() {
  static char buf[100010], *p1 = buf + 100010, *pend = buf + 100010;
  if (p1 == pend) {
    p1 = buf;
    pend = buf + fread(buf, 1, 100010, stdin);
    if (pend == p1) {
      IOerror = 1;
      return -1;
    }
  }
  return *p1++;
}
inline bool blank(char ch) {
  return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
inline int read(char *s) {
  char ch = nc();
  for (; blank(ch); ch = nc())
    ;
  if (IOerror) return 0;
  for (; !blank(ch) && !IOerror; ch = nc()) *s++ = ch;
  *s = 0;
  return 1;
}
inline int RI(int &a) {
  char ch = nc();
  a = 0;
  for (; blank(ch); ch = nc())
    ;
  if (IOerror) return 0;
  for (; !blank(ch) && !IOerror; ch = nc()) a = a * 10 + ch - '0';
  return 1;
}
struct Ostream_fwrite {
  char *buf, *p1, *pend;
  Ostream_fwrite() {
    buf = new char[100010];
    p1 = buf;
    pend = buf + 100010;
  }
  void out(char ch) {
    if (p1 == pend) {
      fwrite(buf, 1, 100010, stdout);
      p1 = buf;
    }
    *p1++ = ch;
  }
  void flush() {
    if (p1 != buf) {
      fwrite(buf, 1, p1 - buf, stdout);
      p1 = buf;
    }
  }
  ~Ostream_fwrite() { flush(); }
} Ostream;
inline void print(char x) { Ostream.out(x); }
inline void println() { Ostream.out('\n'); }
inline void flush() { Ostream.flush(); }
char Out[1000000], *o = Out;
inline void print1(char c) { *o++ = c; }
inline void println1() { *o++ = '\n'; }
inline void flush1() {
  if (o != Out) {
    if (*(o - 1) == '\n') *--o = 0;
    puts(Out);
  }
}
struct puts_write {
  ~puts_write() { flush1(); }
} _puts;
};  // namespace fastIO
using namespace fastIO;
struct point2 {
  double x, y;
  long long val;
  point2() {}
  point2(double _x, double _y) { x = _x, y = _y; }
  point2 operator-(const point2 &ne) { return point2(x - ne.x, y - ne.y); }
  point2 operator+(const point2 &ne) { return point2(x + ne.x, y + ne.y); }
  point2 operator*(const double t) { return point2(x * t, y * t); }
  double operator*(const point2 &o) { return val * o.val; }
};
struct line2 {
  point2 a, b;
  line2() {}
  line2(point2 _a, point2 _b) {
    a = _a;
    b = _b;
  }
};
struct center2 {
  point2 ini;
  point2 d;
  point2 o;
  double r;
  double v;
  center2() {}
  center2(point2 _ini, point2 _d, point2 _o, double _r, double _v) {
    ini = _ini;
    v = _v;
    o = _o;
    r = _r;
    v = _v;
  }
};
double dmult(point2 a, point2 b) { return a.x * b.x + a.y * b.y; }
inline double dmult(point2 o, point2 a, point2 b) {
  return (a.x - o.x) * (b.x - o.x) + (a.y - o.y) * (b.y - o.y);
}
double xmult(point2 a, point2 b) { return a.x * b.y - a.y * b.x; }
double xmult(point2 o, point2 a, point2 b) {
  return (a.x - o.x) * (b.y - o.y) - (b.x - o.x) * (a.y - o.y);
}
double xmult(double x1, double y1, double x2, double y2) {
  return x1 * y2 - x2 * y1;
}
double xmult(line2 x, line2 y) { return xmult(x.b - x.a, y.b - y.a); }
double length(point2 v) { return sqrt(v.x * v.x + v.y * v.y); }
double dist(point2 a, point2 b) { return length(a - b); }
double dist2(point2 a, point2 b) { return dmult(a - b, a - b); }
bool cmp(point2 &a, point2 &b) { return atan2(a.y, a.x) < atan2(b.y, b.x); }
double mysqrt(double x) { return max(0.0, sqrt(x)); }
int sgn(double x) {
  if (fabs(x) < 1e-8) return 0;
  if (x < 0)
    return -1;
  else
    return 1;
}
char in[60];
char mat[1005][60];
int legal[1005];
int vis[60];
int visalpha[30];
int main(void) {
  int n, m;
  int fakem;
  memset((mat), (0), sizeof(mat));
  memset((vis), (0), sizeof(vis));
  memset((visalpha), (0), sizeof(visalpha));
  for (int i = 0; i < 1005; ++i) legal[i] = 1;
  cin >> n;
  scanf("%s", in);
  for (int i = 0; i < n; ++i) {
    if (in[i] == '*') {
      vis[i] = 0;
    } else {
      vis[i] = 1;
      visalpha[in[i] - 'a'] = 1;
    }
  }
  cin >> m;
  fakem = m;
  for (int i = 1; i <= m; ++i) {
    scanf("%s", mat[i]);
  }
  for (int i = 1; i <= m; ++i) {
    for (int j = 0; j < n; ++j) {
      if (vis[j]) {
        if (mat[i][j] != in[j]) {
          legal[i] = 0;
          fakem--;
          break;
        }
      } else {
        if (visalpha[mat[i][j] - 'a']) {
          legal[i] = 0;
          fakem--;
          break;
        }
      }
    }
  }
  int count[30];
  memset((count), (0), sizeof(count));
  for (int i = 0; i < 26; ++i) {
    if (!visalpha[i]) {
      for (int j = 1; j <= m; ++j) {
        if (legal[j]) {
          for (int k = 0; k < n; ++k) {
            if (!vis[k] && mat[j][k] == ((char)('a') + i)) {
              count[i]++;
              break;
            }
          }
        }
      }
    }
  }
  int res = 0;
  for (int i = 0; i < 26; ++i) {
    if (count[i] == fakem) res++;
  }
  cout << res << endl;
  return 0;
}
