#include <bits/stdc++.h>
using namespace std;
string com(string s1, string s2) {
  int freq1[26] = {0}, freq2[26] = {0};
  for (int i = 0; i < s1.size(); i++) {
    freq1[s1[i] - 'a']++;
  }
  for (int i = 0; i < s2.size(); i++) {
    freq2[s2[i] - 'a']++;
  }
  vector<char> ans;
  for (int i = 0; i < 26; i++) {
    if (freq1[i] && freq2[i]) {
      char c = 'a' + i;
      ans.push_back(c);
    }
  }
  return string(ans.begin(), ans.end());
}
string sub(string s1, string s2) {
  int freq1[26] = {0}, freq2[26] = {0};
  for (int i = 0; i < s1.size(); i++) {
    freq1[s1[i] - 'a']++;
  }
  for (int i = 0; i < s2.size(); i++) {
    freq2[s2[i] - 'a']++;
  }
  vector<char> ans;
  for (int i = 0; i < 26; i++) {
    if (freq1[i] && !freq2[i]) {
      char c = 'a' + i;
      ans.push_back(c);
    }
  }
  return string(ans.begin(), ans.end());
}
int main() {
  int n;
  cin >> n;
  string s = "abcdefghijklmnopqrstuvwxyz";
  int k = 0;
  for (; k < n; k++) {
    char c;
    string ss;
    cin >> c >> ss;
    if (c == '!') {
      s = com(s, ss);
    } else if (c == '.' || c == '?') {
      s = sub(s, ss);
    }
    if (s.size() == 1) {
      break;
    }
  }
  int ans = 0;
  k++;
  for (; k < n; k++) {
    char c;
    string ss;
    cin >> c >> ss;
    if (c == '!' || c == '?') {
      ans++;
    }
  }
  cout << max(0, ans - 1);
  return 0;
}
