#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> cand(26, 1);
  bool det = false;
  char res = '!';
  int ans = 0;
  for (int i = 0; i < N; i++) {
    string x, s;
    cin >> x >> s;
    if (x == "!") {
      vector<int> p(26);
      for (char c : s) p[c - 'a'] = 1;
      for (int j = 0; j < 26; j++)
        if (!p[j]) cand[j] = 0;
      if (det) ans++;
    } else {
      for (char c : s) cand[c - 'a'] = 0;
      if (x == "?" && det && res != s[0]) ans++;
    }
    int sum = accumulate(cand.begin(), cand.end(), 0);
    if (!det && sum == 1) {
      det = true;
      for (int j = 0; j < 26; j++)
        if (cand[j]) res = 'a' + j;
    }
  }
  cout << ans << endl;
  return 0;
}
