#include <bits/stdc++.h>
using namespace std;
long long int MIN(long long int a, long long int b) { return (a < b) ? a : b; }
long long int MAX(long long int a, long long int b) { return (a > b) ? a : b; }
long long int ABS(long long int x) { return (x > 0) ? x : -x; }
int MIN(int a, int b) { return (a < b) ? a : b; }
int MAX(int a, int b) { return (a > b) ? a : b; }
int ABS(int x) { return (x > 0) ? x : -x; }
double MIN(double a, double b) { return (a < b) ? a : b; }
double MAX(double a, double b) { return (a > b) ? a : b; }
double ABS(double a, double b) { return (a > 0) ? a : b; }
long long int left(long long int x) { return (x << 1); }
long long int right(long long int x) { return (x << 1) + 1; }
long long int lsone(long long int x) { return (x & (-x)); }
char com[200], word[300000], answer;
int n, ans = 0;
bool possible[200], tmpPos[200], determined = false;
int main() {
  for (int i = 0; i < 200; i++) possible[i] = true;
  scanf("%d", &n);
  for (long long int i = 0; i < (long long int)n; i++) {
    scanf("%s %s", com, word);
    if (determined) {
      if (com[0] == '!') ans++;
      if (com[0] == '?' && i != n - 1)
        ans++;
      else if (com[0] == '?' && i == n - 1 && word[0] != answer)
        ans++;
    }
    int tmpLen = strlen(word);
    for (int j = 0; j < 26; j++) tmpPos[j] = false;
    for (int j = 0; j < tmpLen; j++) {
      tmpPos[word[j] - 'a'] = true;
    }
    int remPos = 0;
    for (int j = 0; j < 26; j++) {
      if (com[0] == '!')
        possible[j] = possible[j] & tmpPos[j];
      else if (com[0] == '.')
        possible[j] = possible[j] & (!tmpPos[j]);
      else
        possible[j] = possible[j] & (!tmpPos[j]);
      if (possible[j]) {
        answer = j + 'a';
        remPos++;
      }
    }
    if (remPos == 1) determined = true;
  }
  printf("%d\n", ans);
}
