#include <bits/stdc++.h>
using namespace std;
int ans[50];
bool check[50];
int main() {
  int n;
  scanf("%d", &n);
  int wrong = 0;
  for (int i = (0); i <= ('z' - 'a'); ++i) ans[i] = 1;
  for (int i = (1); i <= (n); ++i) {
    string t, s;
    cin >> t >> s;
    int res = 0;
    for (int i = (0); i <= ('z' - 'a'); ++i) res += ans[i];
    if (res == 1 && t[0] != '.') ++wrong;
    if (t[0] == '.')
      for (int j = (0); j <= ((int)s.size() - 1); ++j) ans[s[j] - 'a'] = 0;
    else if (t[0] == '!') {
      for (int j = (0); j <= ((int)s.size() - 1); ++j) {
        if (!ans[s[j] - 'a']) continue;
        check[s[j] - 'a'] = 1;
      }
      for (int j = (0); j <= ('z' - 'a'); ++j) {
        ans[j] &= check[j];
        check[j] = 0;
      }
    } else
      ans[s[0] - 'a'] = 0;
  }
  cout << max(0, wrong - 1) << endl;
  return 0;
}
