#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  bool itis = 0;
  int mis = 0;
  cin >> n;
  vector<bool> mb(26, 1);
  for (int i = 0; i < n; i++) {
    char c;
    string wa;
    cin >> c >> wa;
    mis += ((c != '.') & itis);
    vector<bool> th(26, 0);
    for (char c2 : wa) th[c2 - 'a'] = 1;
    for (int j = 0; j < 26; j++) {
      if (c == '!') mb[j] = mb[j] & th[j];
      if (c == '.') mb[j] = mb[j] & (!th[j]);
    }
    if (c == '?') {
      mb[wa[0] - 'a'] = 0;
    }
    int cnt = 0;
    for (int j = 0; j < 26; j++) {
      cnt += mb[j];
    }
    itis = itis | (cnt == 1);
  }
  cout << max(mis - 1, 0);
}
