#include <bits/stdc++.h>
using namespace std;
int n, ans, ans2, sum;
map<char, int> c;
char res, res2;
int main() {
  cin >> n;
  int it = 0;
  for (int i = 0; i < n; i++) {
    char a;
    string str;
    cin >> a >> str;
    if (a == '!') {
      map<char, int> mark;
      for (auto u : str) mark[u] = 1;
      for (char ch = 'a'; ch <= 'z'; ch++)
        if (!c[ch]) {
          if (!mark[ch])
            c[ch] = 1;
          else
            c[ch] = 0;
        }
    } else if (a == '.') {
      for (auto u : str) c[u] = 1;
    } else if (a == '?') {
      if (!c[str[0]]) c[str[0]] = 1;
      if (sum == 24) res2 = str[0];
    }
    it++;
    sum = 0;
    char temp;
    for (char ch = 'a'; ch <= 'z'; ch++)
      if (c[ch])
        sum++;
      else
        temp = ch;
    if (sum == 25) {
      res = temp;
      break;
    }
  }
  for (int i = it; i < n; i++) {
    char c;
    string str;
    cin >> c >> str;
    if (c == '!') {
      ans++;
      ans2++;
    } else if (c == '?' and str[0] != res)
      ans++;
    else if (c == '?' and str[0] != res2)
      ans2++;
  }
  cout << ans;
  return 0;
}
