#include <bits/stdc++.h>
using namespace std;
int count_possible, is_possible;
char t, w[111111];
int main() {
  is_possible = (1 << 26) - 1;
  int n, ans = 0;
  bool determined = false;
  scanf("%d\n", &n);
  while (n--) {
    scanf("%c %s\n", &t, w);
    if (t == '!') {
      int c = 0;
      for (int i = 0; w[i]; i++) c |= 1 << (w[i] - 'a');
      is_possible &= c;
    } else if (t == '.') {
      int c = (1 << 26) - 1;
      for (int i = 0; w[i]; i++) is_possible &= c - (1 << (w[i] - 'a'));
    } else {
      int c = (1 << 26) - 1;
      is_possible &= c - (1 << (w[0] - 'a'));
    }
    if (determined == true) {
      if (t == '!')
        ans++;
      else if (t == '?' && n)
        ans++;
    }
    if ((is_possible & -is_possible) == is_possible) determined = true;
  }
  printf("%d\n", ans);
}
