#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  set<char> maybe;
  vector<char> now;
  for (char i = 'a'; i <= 'z'; i++) maybe.insert(i);
  int ans = 0;
  char ch;
  string str;
  for (int n = 1; n < N; n++) {
    cin >> ch >> str;
    if (ch == '.') {
      int len = str.length();
      for (int i = 0; i < len; i++) {
        if (maybe.find(str[i]) != maybe.end()) maybe.erase(str[i]);
      }
    }
    if (ch == '!') {
      if (maybe.size() == 1)
        ans++;
      else {
        now.clear();
        int len = str.length();
        for (int i = 0; i < len; i++) {
          if (maybe.find(str[i]) != maybe.end()) {
            now.push_back(str[i]);
          }
        }
        maybe.clear();
        for (int i = 0; i < now.size(); i++) maybe.insert(now[i]);
      }
    }
    if (ch == '?') {
      if (maybe.size() == 1) ans++;
      if (maybe.find(str[0]) != maybe.end()) maybe.erase(str[0]);
    }
  }
  cin >> ch >> str;
  cout << ans << endl;
}
