#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int a[31], b[31];
int n, res, k = 26, flag;
string t, s;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> t >> s;
    if (flag) {
      if (t == "!" || (t == "?" && i != n - 1)) res++;
      continue;
    }
    if (t == "!") {
      for (int i = 0; i < 30; ++i) b[i] = 0;
      for (int i = 0; i < s.size(); ++i) b[s[i] - 'a'] = 1;
      for (int i = 0; i < 26; i++)
        if (!b[i] && !a[i]) a[i] = 1, k--;
    } else if (t == ".") {
      for (int i = 0; i < s.size(); i++)
        if (a[s[i] - 'a'] == 0) a[s[i] - 'a'] = 1, k--;
    } else if (t == "?" && i != n - 1)
      if (a[s[0] - 'a'] == 0) a[s[0] - 'a'] = 1, k--;
    if (k == 1) flag = 1;
  }
  cout << res << endl;
}
