#include <bits/stdc++.h>
using namespace std;
int i, n, k;
int vs[100];
int d[100];
int cnt;
int res;
string s;
int main() {
  cnt = 26;
  cin >> n;
  getline(std::cin, s);
  res = 0;
  for (i = 1; i <= n; i++) {
    getline(std::cin, s);
    if (cnt > 1) {
      if (s[0] == '.') {
        for (k = 2; k < s.length(); k++)
          if (vs[s[k] - 'a'] == 0) {
            cnt--;
            vs[s[k] - 'a'] = 1;
          }
      }
      if (s[0] == '!') {
        for (k = 0; k < 26; k++) d[k] = 0;
        for (k = 2; k < s.length(); k++) d[s[k] - 'a'] = 1;
        for (k = 0; k < 26; k++)
          if ((d[k] == 0) && (vs[k] == 0)) {
            cnt--;
            vs[k] = 1;
          }
      }
      if (s[0] == '?') {
        if (vs[s[2] - 'a'] == 0) {
          cnt--;
          vs[s[2] - 'a'] = 1;
        }
      }
    } else if (i != n) {
      if ((s[0] == '?') || (s[0] == '!')) res++;
    }
  }
  cout << res;
}
