#include <bits/stdc++.h>
using namespace std;
int a[30], b[30], d[30];
char s[100005], c;
int main(void) {
  int n, i, j, num = 26, ans = 0, flag = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf(" %c %s", &c, s);
    if (i == n) continue;
    int len = strlen(s);
    if (c == '.') {
      for (j = 0; j < len; j++)
        if (a[s[j] - 'a'] == 0) a[s[j] - 'a'] = 1, num--;
    }
    if (c == '!') {
      int sum = 0;
      if (num <= 1) ans++;
      for (j = 0; j < 26; j++) d[j] = 0;
      for (j = 0; j < len; j++) {
        if (flag == 0) {
          if (b[s[j] - 'a'] == 0 && a[s[j] - 'a'] == 0)
            b[s[j] - 'a'] = 1, sum++;
        } else {
          if (b[s[j] - 'a'] == 1 && d[s[j] - 'a'] == 0 && a[s[j] - 'a'] == 0)
            d[s[j] - 'a'] = 1, sum++;
        }
      }
      if (flag) {
        for (j = 0; j < 26; j++)
          if (d[j] == 0) b[j] = 0;
      }
      for (j = 0; j < 26; j++)
        if (b[j] == 0) a[j] = 1;
      num = min(num, sum);
      flag = 1;
    }
    if (c == '?') {
      if (num <= 1) ans++;
      if (a[s[0] - 'a'] == 0) a[s[0] - 'a'] = 1, num--;
    }
  }
  printf("%d\n", ans);
  return 0;
}
