#include <bits/stdc++.h>
using namespace std;
int main() {
  bool a[26] = {};
  int n, co, co2 = 0;
  cin >> n;
  char c;
  string s;
  for (int i = 0; i < n; i++) {
    bool a2[26] = {};
    cin >> c >> s;
    co = 0;
    for (int j = 0; j < 26; j++)
      if (a[j] == 0) co++;
    if (c == '!') {
      for (int j = 0; j < s.size(); j++) {
        if (a[s[j] - 'a'] == 0) {
          a2[s[j] - 'a'] = 1;
        } else
          a2[s[j] - 'a'] = 0;
      }
      for (int j = 0; j < 26; j++) {
        if (a2[j] == 0)
          a[j] = 1;
        else
          a[j] = 0;
      }
      if (co == 1) co2++;
    } else if (c == '.') {
      for (int j = 0; j < s.size(); j++) {
        a[s[j] - 'a'] = 1;
      }
    } else if (c == '?' && i != n - 1) {
      for (int j = 0; j < s.size(); j++) {
        a[s[j] - 'a'] = 1;
      }
      if (co == 1) co2++;
    }
  }
  cout << co2;
  return 0;
}
