#include <bits/stdc++.h>
using namespace std;
long long expo(long long x, long long n, long long m) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return expo((x * x) % m, n / 2, m);
  else
    return (x * expo((x * x) % m, (n - 1) / 2, m)) % m;
}
string toBinary(long long n) {
  std::string r;
  while (n != 0) {
    r = (n % 2 == 0 ? "0" : "1") + r;
    n /= 2;
  }
  return r;
}
void solve() {
  long long n;
  long long flag = false;
  long long ans = 0;
  vector<long long> final(26, 1);
  char c;
  string s;
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    cin >> c >> s;
    if (flag) {
      if (c == '.') continue;
      ans++;
    }
    if (c == '.') {
      for (long long i = 0; i < s.size(); i++) {
        final[s[i] - 'a'] = 0;
      }
    }
    if (c == '?') {
      final[s[0] - 'a'] = 0;
    }
    if (c == '!') {
      vector<long long> temp(26, 0);
      for (long long i = 0; i < s.size(); i++) {
        temp[s[i] - 'a'] = 1;
      }
      for (long long i = 0; i < 26; i++) {
        if (temp[i] == 0) {
          final[i] = 0;
        }
      }
    }
    long long x = 0;
    for (long long i = 0; i < 26; i++) x += final[i];
    if (x == 1) flag = true;
  }
  cin >> c >> s;
  cout << ans << endl;
  return;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
