#include <bits/stdc++.h>
using namespace std;
bool vis[26];
bool vis1[26];
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  memset(vis, true, sizeof(vis));
  int cnt = 26;
  int num = 0;
  for (int i = 1; i < n; i++) {
    char op;
    cin >> op;
    if (op == '.') {
      string s;
      cin >> s;
      for (int j = 0; j < s.length(); j++) {
        if (vis[s[j] - 'a']) {
          cnt--;
          vis[s[j] - 'a'] = false;
        }
      }
    } else if (op == '!') {
      string s;
      cin >> s;
      memset(vis1, false, sizeof(vis1));
      for (int j = 0; j < s.length(); j++) {
        vis1[s[j] - 'a'] = true;
      }
      if (cnt == 1) num++;
      for (int j = 0; j < 26; j++) {
        if (vis[j] == true && vis1[j] == false) {
          cnt--;
          vis[j] = false;
        }
      }
    } else if (op == '?') {
      string s;
      cin >> s;
      if (cnt == 1)
        num++;
      else {
        if (vis[s[0] - 'a']) {
          vis[s[0] - 'a'] = false;
          cnt--;
        }
      }
    }
  }
  cout << num << endl;
  return 0;
}
