#include <bits/stdc++.h>
using namespace std;
int N, ret = 0;
set<char> possible;
bool isIdiot = false;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(4);
  cin >> N;
  for (int i = 0; i < 26; i++) possible.insert(char('a' + i));
  for (int i = 1; i <= N; i++) {
    char c;
    string s;
    cin >> c >> s;
    if (isIdiot) {
      if (c == '?' && i != N)
        ret++;
      else if (c == '!')
        ret++;
      continue;
    }
    if (c == '!') {
      set<char> notSaid;
      for (int i = 0; i < 26; i++) notSaid.insert(char('a' + i));
      for (int j = 0; j < s.length(); j++) notSaid.erase(s[j]);
      for (char kek : notSaid) possible.erase(kek);
    } else if (c == '.') {
      set<char> said;
      for (int j = 0; j < s.length(); j++) said.insert(s[j]);
      for (char kek : said) possible.erase(kek);
    } else {
      if (i != N) possible.erase(s[0]);
    }
    if (possible.size() == 1) isIdiot = true;
  }
  cout << ret << '\n';
  return 0;
}
