#include <bits/stdc++.h>
using namespace std;
vector<char> metszet(vector<char> v1, string v2) {
  int i = 0, j = 0, c = 0;
  vector<char> m;
  while (i < v1.size() && j < v2.size()) {
    if (v1[i] < v2[j])
      i++;
    else if (v1[i] > v2[j])
      j++;
    else {
      m.push_back(v1[i++]);
      j++;
    }
  }
  return m;
}
vector<char> kulonbseg(vector<char> v1, string v2) {
  int i = 0, j = 0, c = 0;
  vector<char> m;
  while (i < v1.size() && j < v2.size()) {
    if (v1[i] == v2[j]) {
      i++;
      j++;
    } else if (v1[i] < v2[j]) {
      m.push_back(v1[i++]);
    } else {
      j++;
    }
  }
  while (i < v1.size()) m.push_back(v1[i++]);
  return m;
}
int main() {
  vector<char> chars(26);
  for (int i = 0; i < 26; ++i) {
    chars[i] = i + 'a';
  }
  int n, shocks = 0;
  cin >> n;
  bool known = false;
  char c;
  string line;
  getline(cin, line);
  for (int i = 0; i < n; ++i) {
    getline(cin, line, '\n');
    c = line[0];
    line = line.substr(2);
    sort(line.begin(), line.end());
    if (c == '.') {
      chars = kulonbseg(chars, line);
    } else if (c == '?') {
      if (i < n - 1) {
        chars = kulonbseg(chars, line);
        if (known) shocks++;
      }
    } else if (c == '!') {
      chars = metszet(chars, line);
      if (known) shocks++;
    }
    if (!known && chars.size() == 1) {
      known = true;
    }
  }
  cout << shocks << endl;
  return 0;
}
