#include <bits/stdc++.h>
using namespace std;
void SolveA() {
  int possible[26];
  for (int i = 0; i < 26; ++i) possible[i] = 1;
  string s;
  getline(cin, s);
  size_t n;
  {
    stringstream ss(s);
    ss >> n;
  }
  size_t nPossible = 26;
  char letter;
  size_t res = 0;
  for (size_t i = 0; i < n; ++i) {
    getline(cin, s);
    if (s[0] == '.') {
      for (size_t j = 0; j < s.length(); ++j) {
        if (s[j] >= 'a' && s[j] <= 'z' && possible[s[j] - 'a'] == 1) {
          possible[s[j] - 'a'] = 0;
          --nPossible;
        }
      }
    }
    if (s[0] == '!') {
      if (nPossible == 1) ++res;
      int seen[26] = {0};
      for (size_t j = 0; j < s.length(); ++j) {
        if (s[j] >= 'a' && s[j] <= 'z') seen[s[j] - 'a'] = 1;
      }
      for (size_t j = 0; j < 26; ++j)
        if (!seen[j] && possible[j]) {
          possible[j] = 0;
          --nPossible;
        }
    }
    if (s[0] == '?') {
      if (i + 1 < n && nPossible == 1) ++res;
      if (possible[s[2] - 'a']) {
        possible[s[2] - 'a'] = 0;
        --nPossible;
      }
    }
  }
  cout << res;
}
int main() {
  SolveA();
  return 0;
}
