#include <bits/stdc++.h>
using namespace std;
map<char, int> alpha = {
    {'a', 0},  {'b', 1},  {'c', 2},  {'d', 3},  {'e', 4},  {'f', 5},  {'g', 6},
    {'h', 7},  {'i', 8},  {'j', 9},  {'k', 10}, {'l', 11}, {'m', 12}, {'n', 13},
    {'o', 14}, {'p', 15}, {'q', 16}, {'r', 17}, {'s', 18}, {'t', 19}, {'u', 20},
    {'v', 21}, {'w', 22}, {'x', 23}, {'y', 24}, {'z', 25},
};
vector<int> analyze_alpha(26, 0);
int get_cnt_unknown_symbols(int num) {
  int cnt = 0;
  for (int i = 0; i < 26; i++)
    if (analyze_alpha[i] == num) cnt++;
  return cnt;
}
int main() {
  int n;
  cin >> n;
  int res = 0;
  for (int i = 0; i < n; i++) {
    char c;
    string text;
    cin >> c >> text;
    if (i == n - 1) break;
    if (get_cnt_unknown_symbols(1) == 1 && (c == '!' || c == '?'))
      res++;
    else if (get_cnt_unknown_symbols(1) == 0 &&
             get_cnt_unknown_symbols(0) == 1 && (c == '!' || c == '?'))
      res++;
    int status;
    if (c == '!') status = 1;
    if ((c == '.') || (c == '?')) status = 2;
    for (int j = 0; j < text.length(); j++)
      if (analyze_alpha[alpha[text[j]]] < status)
        analyze_alpha[alpha[text[j]]] = status;
    if (status == 1) {
      for (int j = 0; j < 26; j++) {
        bool flag = false;
        for (int k = 0; k < text.length(); k++)
          if (j == alpha[text[k]]) {
            flag = true;
            break;
          }
        if (!flag) analyze_alpha[j] = 2;
      }
    }
  }
  cout << res;
  return 0;
}
