#include <bits/stdc++.h>
using namespace std;
set<char> contains, doesnt;
void func(string str) {
  int len = str.size(), i, j, k;
  int sz = contains.size();
  if (sz == 0) {
    for (i = 0; i < len; i++) {
      contains.insert(str[i]);
      doesnt.erase(str[i]);
    }
  } else {
    set<char> temp;
    set<char>::iterator it1, it2;
    for (i = 0; i < len; i++) {
      if (contains.find(str[i]) == contains.end()) {
        doesnt.insert(str[i]);
      } else {
        temp.insert(str[i]);
      }
    }
    for (it1 = contains.begin(); it1 != contains.end(); it1++) {
      if (temp.find(*it1) == temp.end()) {
        doesnt.insert(*it1);
      }
    }
    contains = temp;
  }
}
int main() {
  int n, i, j, k;
  scanf("%d", &n);
  bool done = 0;
  int ans = 0;
  for (i = 0; i < 26; i++) contains.insert('a' + i);
  for (i = 0; i < n; i++) {
    string str1, str2;
    cin >> str1 >> str2;
    int len = str2.size();
    if (str1 == ".") {
      if (done == 0) {
        for (j = 0; j < len; j++) {
          doesnt.insert(str2[j]);
          contains.erase(str2[j]);
        }
      }
    } else if (str1 == "!") {
      if (done)
        ans++;
      else
        func(str2);
    } else {
      if (done) ans++;
      if (i < n - 1 and done == 0) {
        contains.erase(str2[0]);
        doesnt.insert(str2[0]);
      }
    }
    int sz1 = doesnt.size(), sz2 = contains.size();
    if (done == 0 and (sz1 == 25 or sz2 == 1)) {
      done = 1;
    }
  }
  if (ans > 0) ans--;
  cout << ans << endl;
  return 0;
}
