#include <bits/stdc++.h>
using namespace std;
int n;
int ans;
bool bad[300];
bool ok;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    char tp;
    string s;
    cin >> tp >> s;
    if (tp == '.') {
      for (auto it : s) bad[it - 'a'] = 1;
    } else if (tp == '!') {
      if (ok) {
        ans++;
        continue;
      }
      vector<bool> yes;
      yes.resize(27);
      for (auto it : s) {
        if (bad[it - 'a']) continue;
        yes[it - 'a'] = 1;
      }
      for (char c = 0; c < 26; c++) {
        if (yes[c] != 1) {
          bad[c] = 1;
        }
      }
    } else if (tp == '?') {
      if (i < n) {
        bad[s[0] - 'a'] = 1;
        if (ok) {
          ans++;
          continue;
        }
      }
    }
    int cnt = 0;
    for (char c = 0; c < 26; c++) {
      if (bad[c]) continue;
      cnt++;
    }
    if (cnt == 1 && !ok) ok = 1;
  }
  cout << ans;
  return 0;
}
