#include <bits/stdc++.h>
using namespace std;
bool safe[30], unde[30];
int main() {
  int n;
  char op;
  string s;
  bool ok = false;
  int shocker = 0;
  cin >> n;
  while (n--) {
    cin >> op >> s;
    if (op == '.') {
      for (int i = 0; i < s.size(); ++i) safe[s[i] - 'a'] = 1;
    } else if (op == '!') {
      memset(unde, false, sizeof(unde));
      for (int i = 0; i < s.size(); ++i) unde[s[i] - 'a'] = 1;
      for (int i = 0; i < 26; ++i)
        if (!unde[i]) safe[i] = 1;
      if (ok) shocker++;
    } else if (op == '?') {
      if (ok && safe[s[0] - 'a'])
        shocker++;
      else
        safe[s[0] - 'a'] = 1;
    }
    int cnt = 0;
    for (int i = 0; i < 26; i++)
      if (!safe[i]) cnt++;
    if (cnt == 1) ok = true;
  }
  cout << shocker << endl;
  return 0;
}
