#include <bits/stdc++.h>
using namespace std;
bool v[26];
bool freq[26];
int main() {
  memset(v, true, sizeof v);
  int n;
  cin >> n;
  int let = 26;
  int ans = 0;
  for (int i = 0; i < n - 1; ++i) {
    string s;
    cin >> s;
    if (let == 1) {
      if (s[0] != '.') ans++;
      cin >> s;
      continue;
    }
    if (s[0] == '.') {
      cin >> s;
      for (int i = 0; i < s.size(); ++i) {
        if (v[s[i] - 'a']) let--;
        v[s[i] - 'a'] = false;
      }
    } else if (s[0] == '!') {
      cin >> s;
      memset(freq, false, sizeof freq);
      for (int i = 0; i < s.size(); ++i) {
        freq[s[i] - 'a'] = true;
      }
      for (int i = 0; i < 26; ++i) {
        if (!freq[i]) {
          if (v[i]) let--;
          v[i] = false;
        }
      }
    } else {
      cin >> s;
      if (v[s[0] - 'a']) let--;
      v[s[0] - 'a'] = false;
    }
  }
  cout << ans << endl;
  return 0;
}
