#include <bits/stdc++.h>
using namespace std;
int a[26];
int main() {
  int n, res = 0, m = 0, am = 26, i, x;
  string w;
  char action;
  cin >> n;
  for (x = 0; x < n; x++) {
    cin >> action >> w;
    if (am == 1) {
      res += ((action == '?' && x != n - 1) || action == '!');
      continue;
    }
    set<char> s;
    if (action == '!') {
      res += (am == 1);
      for (i = 0; i < w.size(); i++) {
        if (s.find(w[i]) == s.end()) {
          s.insert(w[i]);
          if (a[w[i] - 'a'] == m - 1) {
            am++;
          } else if (a[w[i] - 'a'] == m) {
            m++;
            am = 1;
          }
          a[w[i] - 'a']++;
        }
      }
    } else if (action == '.') {
      for (i = 0; i < w.size(); i++) {
        if (s.find(w[i]) == s.end()) {
          s.insert(w[i]);
          if (a[w[i] - 'a'] == m) {
            am--;
          }
          a[w[i] - 'a']--;
        }
      }
    } else if (action == '?' && x != n - 1) {
      if (a[w[0] - 'a'] == m) {
        am--;
      }
      a[w[0] - 'a']--;
    }
  }
  cout << res << endl;
}
