#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
const double eps = 1e-8;
template <typename T>
inline void read(T &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= f;
}
const int U = 26, LEN = 100010;
char s[LEN], type[5];
int n;
bool can[U + 10], tmp[U + 10];
bool fl = 0;
int ans = 0;
signed main() {
  read(n);
  memset(can, 1, sizeof can);
  for (int i = 1; i <= n; i++) {
    scanf("%s", type + 1);
    scanf("%s", s + 1);
    if (fl) {
      if (type[1] != '.' && i != n) ++ans;
      continue;
    }
    int ls = strlen(s + 1);
    if (type[1] == '!') {
      for (int j = 1; j <= ls; j++) tmp[s[j] - 'a'] = 1;
      for (int j = 0; j < U; j++)
        if (!tmp[j]) {
          can[j] = 0;
        } else
          tmp[j] = 0;
    } else if (type[1] == '.') {
      for (int j = 1; j <= ls; j++) can[s[j] - 'a'] = 0;
    } else if (type[1] == '?') {
      for (int j = 1; j <= ls; j++) can[s[j] - 'a'] = 0;
    }
    if (!fl) {
      int cnt = 0;
      for (int j = 0; j < U; j++) cnt += can[j];
      fl = (cnt == 1);
    }
  }
  printf("%d\n", ans);
  return 0;
}
