#include <bits/stdc++.h>
using namespace std;
bool pr[100005];
int main() {
  std::ios::sync_with_stdio(false);
  long long int n;
  cin >> n;
  for (long long int i = 1; i <= 26; i++) {
    pr[i] = true;
  }
  bool ok = true;
  long long int ans = 0;
  for (long long int i = 1; i <= n - 1; i++) {
    char xx;
    string s;
    cin >> xx >> s;
    if (xx == '!') {
      if (!ok) ans++;
      bool chk[27];
      for (long long int j = 1; j <= 26; j++) chk[j] = false;
      for (auto c : s) {
        chk[c - 'a' + 1] = true;
      }
      for (long long int j = 1; j <= 26; j++) {
        if (!chk[j]) pr[j] = false;
      }
    }
    if (xx == '.') {
      bool chk[27];
      for (long long int j = 1; j <= 26; j++) chk[j] = false;
      for (auto c : s) {
        chk[c - 'a' + 1] = true;
      }
      for (long long int j = 1; j <= 26; j++) {
        if (chk[j]) pr[j] = false;
      }
    }
    if (xx == '?') {
      if (!ok) ans++;
      char ra = s[0];
      pr[ra - 'a' + 1] = false;
    }
    if (!ok) continue;
    long long int cnt = 0;
    for (long long int j = 1; j <= 26; j++) {
      if (pr[j]) cnt++;
    }
    if (cnt == 1) {
      ok = false;
    }
  }
  cout << ans;
  return 0;
}
