#include <bits/stdc++.h>
using namespace std;
int n, shock = 0;
bitset<26> candidate, temp;
char word[100010], operation[10];
bool flag = false;
int main() {
  cin >> n;
  n--;
  candidate.flip();
  while (n--) {
    scanf("%s", operation);
    scanf("%s", word);
    if (flag && operation[0] != '.') {
      shock++;
      continue;
    }
    temp.reset();
    for (int i = 0; i < strlen(word); i++) {
      temp[word[i] - 'a'] = 1;
    }
    if (operation[0] == '!') {
      candidate &= temp;
    } else {
      candidate &= ~temp;
    }
    if (candidate.count() == 1) {
      flag = true;
    }
  }
  cout << shock << endl;
  return 0;
}
