#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, d = 0, j;
  cin >> n;
  char c[n];
  vector<string> s(n);
  for (i = 0; i < n; i++) cin >> c[i] >> s[i];
  int cou = 26;
  vector<bool> safe(26, 1);
  for (i = 0; i < n - 1; i++) {
    bool curr[26];
    if (c[i] == '.' || c[i] == '?') {
      memset(curr, 1, 26 * sizeof(curr[0]));
      for (j = 0; j < s[i].size(); j++) curr[s[i][j] - 'a'] = 0;
    } else if (c[i] == '!') {
      memset(curr, 0, 26 * sizeof(curr[0]));
      for (j = 0; j < s[i].size(); j++) curr[s[i][j] - 'a'] = 1;
    }
    for (j = 0; j < 26; j++) {
      if (safe[j] != curr[j] && safe[j] == 1) cou--;
      safe[j] = safe[j] & curr[j];
    }
    if (cou == 1) break;
  }
  cou = 0;
  for (i = i + 1; i < n - 1; i++)
    if (c[i] != '.') cou++;
  cout << cou;
}
