#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  unordered_set<char> candidates;
  for (int i = 0; i < 26; i++) {
    candidates.insert('a' + i);
  }
  bool found = false;
  char t;
  string s;
  int n, ans = 0;
  cin >> n;
  while (n--) {
    cin >> t >> s;
    if (found && t != '.') {
      ans++;
    }
    if (t == '!') {
      bool marked[26];
      memset(marked, false, sizeof marked);
      for (int i = 0; i < s.size(); i++) {
        marked[s[i] - 97] = true;
      }
      for (auto itr = candidates.begin(); itr != candidates.end();) {
        if (!marked[*itr - 97]) {
          itr = candidates.erase(itr);
        } else {
          itr++;
        }
      }
    } else if (t == '.') {
      for (char c : s) {
        candidates.erase(c);
      }
    } else {
      candidates.erase(s[0]);
    }
    if (candidates.size() == 1) {
      found = true;
    }
  }
  cout << max(0, ans - 1);
  return 0;
}
