#include <bits/stdc++.h>
using namespace std;
set<char> xz;
set<char> cur;
int main() {
  int n, ans = 0, p = 0;
  cin >> n;
  for (char i = 'a'; i <= 'z'; i++) {
    xz.insert(i);
  }
  for (int i = 0; i < n; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    if (p == 1) {
      if (s1 == "!" || (s1 == "?" && i != n - 1)) ans++;
      continue;
    }
    if (s1 == ".") {
      for (int e = 0; e < s2.size(); e++) xz.erase(s2[e]);
      if (xz.size() == 1) {
        p = 1;
      }
    }
    if (s1 == "!") {
      cur.clear();
      for (int e = 0; e < s2.size(); e++) cur.insert(s2[e]);
      set<char> y;
      y.clear();
      for (auto e : xz) {
        if (cur.count(e) == 0) y.insert(e);
      }
      for (auto e : y) xz.erase(e);
      if (xz.size() == 1) {
        p = 1;
      }
    }
    if (s1 == "?") {
      if (i == n - 1)
        p = 1;
      else
        xz.erase(s2[0]);
      if (xz.size() == 1) {
        p = 1;
      }
    }
  }
  cout << ans;
  return 0;
}
