#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T Max(T a, T b) {
  return a > b ? a : b;
}
template <class T>
inline T Min(T a, T b) {
  return a < b ? a : b;
}
inline long long LAbs(long long x) { return x > 0 ? x : -x; }
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
const int N = 1e5 + 10;
bool vis[27];
int may[27];
int main() {
  int n;
  char str[N];
  scanf("%d", &n);
  for (int i = 0; i < 27; i++) may[i] = 1;
  int sh = 0, flag = 0, least = 0;
  for (int i = 0; i < n; i++) {
    char op[5];
    scanf("%s%s", op, str);
    int len = strlen(str);
    if (op[0] == '.') {
      for (int j = 0; j < len; j++) {
        vis[str[j] - 'a'] = 1;
        may[str[j] - 'a'] = 0;
      }
    } else if (op[0] == '!') {
      sh++;
      if (!flag) least++;
      int put[27];
      for (int j = 0; j < 27; j++) put[j] = 0;
      for (int j = 0; j < len; j++) put[str[j] - 'a'] = 1;
      for (int j = 0; j < 27; j++) {
        int th = may[j];
        may[j] = th & put[j];
      }
    } else {
      if (!flag && i != n - 1) least++;
      if (i != n - 1) vis[str[0] - 'a'] = 1, sh++;
    }
    int Not = 0, m = 0;
    for (int j = 0; j < 27; j++)
      if (vis[j]) may[j] = 0;
    for (int j = 0; j < 26; j++)
      if (vis[j]) Not++;
    for (int j = 0; j < 26; j++)
      if (may[j] == 1) m++;
    if (m == 1 || Not == 25) flag = 1;
  }
  printf("%d\n", sh - least);
  return 0;
}
