#include <bits/stdc++.h>
using namespace std;
int n, arr[26], ans, mx, cnt = 26;
char c, str[100005];
int main() {
  scanf("%d\n", &n);
  while (--n && scanf("%c %s\n", &c, &str)) {
    if (cnt <= 1) {
      ans += (c == '?' || c == '!');
      continue;
    }
    for (int i = 0; i < 26; ++i) mx = max(mx, arr[i]);
    if (c == '.')
      for (int i = 0; str[i] != '\0'; ++i) {
        if (arr[str[i] - 'a'] != -1) --cnt, arr[str[i] - 'a'] = -1;
      }
    else if (c == '?') {
      if (arr[str[0] - 'a'] != -1) --cnt, arr[str[0] - 'a'] = -1;
    } else {
      for (int i = 0; str[i] != '\0'; ++i)
        if (arr[str[i] - 'a'] == mx) ++arr[str[i] - 'a'];
      for (int i = 0; i < 26; ++i)
        if (arr[i] <= mx && arr[i] != -1) --cnt, arr[i] = -1;
    }
  }
  printf("%d\n", ans);
  return 0;
}
