#include <bits/stdc++.h>
using namespace std;
int mask = (1 << 26) - 1;
void del(int c) {
  int m = (1 << 26) - 1;
  m ^= (1 << c);
  mask &= m;
}
const int N = 100010;
char s[N];
int main() {
  int t;
  scanf("%d", &t);
  int ans = 0;
  while (t--) {
    char cmd[3];
    scanf("%s %s", cmd, s);
    if (cmd[0] == '.') {
      int n = strlen(s);
      for (int i = 0; i < n; i++) del(s[i] - 'a');
    } else if (cmd[0] == '!') {
      if (__builtin_popcount(mask) == 1) ans++;
      int freq[26] = {0}, n = strlen(s);
      for (int i = 0; i < n; i++) {
        freq[s[i] - 'a']++;
      }
      for (int i = 0; i < 26; i++) {
        if (!freq[i]) del(i);
      }
    } else {
      if (__builtin_popcount(mask) == 1 and t > 0) ans++;
      del(s[0] - 'a');
    }
  }
  printf("%d\n", ans);
  return 0;
}
