#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chkmin(T &x, const T &y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
bool chkmax(T &x, const T &y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
T read() {
  T x = 0, f = 1;
  char c = getchar_unlocked();
  while ((c < '0') || (c > '9')) {
    if (c == '-') f = -1;
    c = getchar_unlocked();
  }
  while ((c >= '0') && (c <= '9'))
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar_unlocked();
  return x * f;
}
template <typename T>
void write(T x, char c) {
  static char t[25];
  static int tlen;
  t[tlen = 1] = c;
  if (x < 0) putchar_unlocked('-'), x = -x;
  do t[++tlen] = (x % 10) ^ 48;
  while (x /= 10);
  while (tlen) putchar_unlocked(t[tlen--]);
}
const int maxn = 100005;
int n;
bool p[26], mark[26];
char c[10], s[maxn];
int main() {
  int ans = 0;
  memset(p, 1, sizeof(p));
  n = read<int>();
  bool k = 0;
  for (int i = (int)(1), iend = (int)(n); i <= iend; ++i) {
    scanf("%s%s", c, s);
    int len = strlen(s);
    if (c[0] == '.')
      for (int j = (int)(0), jend = (int)(len - 1); j <= jend; ++j)
        p[s[j] - 'a'] = 0;
    else if (c[0] == '!') {
      ans += k;
      memset(mark, 0, sizeof(mark));
      for (int j = (int)(0), jend = (int)(len - 1); j <= jend; ++j)
        mark[s[j] - 'a'] = 1;
      bool flag = 0;
      for (int j = (int)(0), jend = (int)(25); j <= jend; ++j)
        if (p[j] & (!mark[j])) p[j] = 0, flag = 1;
    } else if (!p[s[0] - 'a'])
      ans += k;
    else
      p[s[0] - 'a'] = 0;
    int tmp = 0;
    for (int j = (int)(0), jend = (int)(25); j <= jend; ++j)
      if (!p[j]) tmp++;
    if (tmp == 25) k = 1;
  }
  write(ans, '\n');
  return 0;
}
