#include <bits/stdc++.h>
using namespace std;
int n;
char in[5], s[100005];
bool ok[26];
void init() {
  scanf("%d", &n);
  for (int i = 0; i < 26; i++) ok[i] = true;
  int ans = 26, sum = 0;
  for (int i = 0; i < n; i++) {
    scanf("%s%s", in, s);
    int len = strlen(s);
    if (i + 1 == n) break;
    if (in[0] == '.') {
      for (int j = 0; j < len; j++) {
        int ch = s[j] - 'a';
        if (ok[ch] == true) ok[ch] = false, ans--;
      }
    } else if (in[0] == '?') {
      if (ans == 1) sum++;
      int ch = s[0] - 'a';
      if (ok[ch] == true) ok[ch] = false, ans--;
    } else {
      if (ans == 1) sum++;
      bool tmp[26];
      for (int j = 0; j < 26; j++) tmp[j] = true;
      for (int j = 0; j < len; j++) {
        int ch = s[j] - 'a';
        if (tmp[ch] == true) tmp[ch] = false;
      }
      for (int j = 0; j < 26; j++)
        if (tmp[j] == true)
          if (ok[j] == true) ok[j] = false, ans--;
    }
  }
  printf("%d\n", sum);
}
void process() {}
int main() {
  init();
  process();
  return 0;
}
