#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, a[26], flag = 0, ans = 0;
  for (int i = 0; i < 26; i++) a[i] = 1;
  cin >> n;
  char c;
  string w;
  for (int i = 0; i < n; i++) {
    cin >> c;
    cin >> w;
    if (flag == 1 && c == '!') {
      ans++;
      continue;
    } else if (flag == 1 && c == '?' && i < n - 1) {
      ans++;
      continue;
    }
    if (c == '.') {
      for (int i = 0; i < w.length(); i++) a[w[i] - 'a'] = 0;
    } else if (c == '!') {
      int b[26] = {0};
      for (int i = 0; i < w.length(); i++) b[w[i] - 'a'] = 1;
      for (int i = 0; i < 26; i++)
        if (!a[i] || !b[i]) a[i] = 0;
    } else if (c == '?') {
      a[w[0] - 'a'] = 0;
    }
    int sum = 0;
    for (int i = 0; i < 26; i++) sum += a[i];
    if (sum == 1) flag = 1;
  }
  cout << ans << endl;
  return 0;
}
