#include <bits/stdc++.h>
using namespace std;
char op;
char s[200100];
int n;
int ans;
char c;
int tam;
set<char> good, bad;
set<char>::iterator it;
bool ok = false;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf(" %c %s", &op, s);
    tam = strlen(s);
    if (!ok) {
      if (op == '.') {
        for (int j = 0; j < tam; ++j) {
          good.insert(s[j]);
          if (bad.count(s[j])) {
            bad.erase(s[j]);
          }
        }
      }
      if (op == '!') {
        if (bad.size() == 0) {
          for (int j = 0; j < tam; ++j) {
            if (!good.count(s[j])) {
              bad.insert(s[j]);
            }
          }
          for (char j = 'a'; j <= 'z'; ++j) {
            if (!bad.count(j)) {
              good.insert(j);
            }
          }
        } else {
          set<char> aux;
          for (int j = 0; j < tam; ++j) {
            aux.insert(s[j]);
          }
          vector<char> rem;
          for (it = bad.begin(); it != bad.end(); ++it) {
            if (!aux.count(*it)) {
              rem.push_back(*it);
            }
          }
          for (int i = 0; i < rem.size(); ++i) {
            bad.erase(rem[i]);
            good.insert(rem[i]);
          }
          for (char j = 'a'; j <= 'z'; ++j) {
            if (!bad.count(j) && !aux.count(j)) {
              good.insert(j);
            }
          }
        }
      }
      if (op == '?') {
        good.insert(s[0]);
        if (bad.count(s[0])) {
          bad.erase(s[0]);
        }
      }
      if (bad.size() == 1) {
        ok = true;
        c = *bad.begin();
      } else if (good.size() == 25) {
        for (char j = 'a'; j <= 'z'; ++j) {
          if (!good.count(j)) {
            ok = true;
            c = j;
            break;
          }
        }
      }
    } else {
      if (op == '!') ans++;
      if (op == '?' && i < n - 1) ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
