#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  vector<int> cand(26, 1);
  string t, w;
  int f = 0, ans = 0;
  for (int i = 0; i < n - 1; i++) {
    cin >> t >> w;
    if (f == 1) {
      ans += (t == "!" || t == "?");
      continue;
    }
    if (t == "!") {
      vector<int> temp(26, 0);
      for (char c : w) {
        temp[c - 'a'] = 1;
      }
      for (int i = 0; i < 26; i++) {
        cand[i] = min(cand[i], temp[i]);
      }
    } else if (t == ".") {
      for (char c : w) {
        cand[c - 'a'] = 0;
      }
    } else if (t == "?") {
      cand[w[0] - 'a'] = 0;
    }
    if (!f) {
      int ff = 0;
      for (int i = 0; i < 26; i++) {
        ff += (cand[i] > 0);
      }
      if (ff == 1) {
        f = 1;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
