#include <bits/stdc++.h>
using namespace std;
int n, d[30], c[30], i, now, ans;
char ch[100];
char s[100010];
int main() {
  scanf("%d\n", &n);
  bool flag = 0;
  memset(c, 0, sizeof(c));
  for (int j = 1; j <= n; j++) {
    scanf("%s", &ch);
    scanf("%s", s);
    int l = strlen(s);
    if (ch[0] == '.') {
      for (i = 0; i < l; i++) {
        c[s[i] - 'a'] = 1;
      }
    }
    if (ch[0] == '!') {
      memset(d, 0, sizeof(d));
      for (i = 0; i < l; i++) {
        d[s[i] - 'a'] = 1;
      }
      for (i = 0; i < 26; i++)
        if (!d[i]) c[i] = 1;
      if (flag) now++;
    }
    if (ch[0] == '?' && j != n) {
      c[s[0] - 'a'] = 1;
      if (flag) now++;
    }
    int ans = 26;
    for (i = 0; i < 26; i++) ans -= c[i];
    if (ans == 1) flag = 1;
  }
  printf("%d\n", now);
}
