#include <bits/stdc++.h>
using namespace std;
int letter[26];
set<char> maybe, no;
int main() {
  int n;
  cin >> n;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    char c;
    string w;
    cin >> c >> w;
    if (maybe.size() == 1 or no.size() == 25) {
      if (c == '!' or (c == '?' and i != n - 1)) cnt++;
    } else if (c == '!') {
      set<char> maybe2;
      if (maybe.size() == 0) {
        for (int i = 0; i < w.length(); i++) {
          if (no.find(w[i]) == no.end()) maybe.insert(w[i]);
        }
      } else {
        for (int i = 0; i < w.length(); i++) {
          if (maybe.find(w[i]) == maybe.end())
            no.insert(w[i]);
          else
            maybe2.insert(w[i]);
        }
        maybe = maybe2;
      }
    } else if (c == '.') {
      for (int i = 0; i < w.length(); i++) {
        no.insert(w[i]);
        if (maybe.find(w[i]) != maybe.end()) maybe.erase(w[i]);
      }
    } else {
      if (maybe.find(w[0]) != maybe.end()) maybe.erase(w[0]);
      no.insert(w[0]);
    }
  }
  cout << cnt;
}
