#include <bits/stdc++.h>
using namespace std;
int main() {
  int possib[26], n, got = 0, bestgot = -1;
  char act[2], s[100005];
  for (int i = (0); i < (26); ++i) possib[i] = 1;
  scanf("%d", &n);
  for (int isadbasid = (0); isadbasid < (n); ++isadbasid) {
    int present[26];
    for (int i = (0); i < (26); ++i) present[i] = 0;
    scanf("%s %s", act, s);
    for (int i = 0; s[i] != '\0'; i++) {
      present[s[i] - 'a'] = 1;
    }
    if (*act == '!') {
      got++;
      for (int i = (0); i < (26); ++i)
        if (!present[i]) possib[i] = 0;
    } else if (*act == '.') {
      for (int i = (0); i < (26); ++i)
        if (present[i]) possib[i] = 0;
    } else {
      if (isadbasid != n - 1) got++;
      possib[s[0] - 'a'] = 0;
    }
    int cnt = 0;
    for (int i = (0); i < (26); ++i) cnt += possib[i];
    ;
    if (cnt == 1 && bestgot == -1) bestgot = got;
  };
  if (bestgot == -1) bestgot = got;
  printf("%d\n", got - bestgot);
  return 0;
}
