#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int ban[30], a[30], may[N];
char s[N], op[30];
int main() {
  int n, tot = 26;
  bool flag = false, fi = false;
  scanf("%d", &n);
  memset(ban, 0, sizeof(ban));
  memset(may, 0, sizeof(may));
  int res = 0;
  char ans = '#';
  for (int k = 1; k <= n; k++) {
    scanf("%s%s", op, s + 1);
    if (flag) {
      if ((op[0] == '?' && k != n) || op[0] == '!') res++;
      continue;
    }
    memset(a, 0, sizeof(a));
    for (int i = 1; s[i]; i++) a[s[i] - 'a'] = 1;
    if (op[0] == '!') {
      for (int i = 0; i < 26; i++)
        if (!a[i] && !ban[i]) ban[i] = 1, tot--;
    }
    if (op[0] == '.') {
      for (int i = 0; i < 26; i++)
        if (a[i] && (!ban[i])) ban[i] = 1, tot--;
    }
    if (op[0] == '?' && !ban[s[1] - 'a']) ban[s[1] - 'a'] = 1, tot--;
    int cnt = 0;
    for (int i = 0; i < 26; i++)
      if (ban[i]) cnt++;
    if (tot == 1) flag = true;
  }
  printf("%d\n", res);
  return 0;
}
