#include <bits/stdc++.h>
using namespace std;
const long long maxN = 1e6 + 5;
const long long inf = 1e10;
const long long mod = 1e9 + 7;
long long n;
char c;
string s;
long long check[1000];
long long calc() {
  long long cnt = 0;
  for (long long i = 'a'; i <= 'z'; i++)
    if (check[i] == 0) cnt++;
  return cnt;
}
long long tmp[maxN];
string res = "qwertyuiopasdfghjklzxcvbnm";
long long inString(char c, string s) {
  for (long long i = 0; i <= s.size() - 1; i++)
    if (c == s[i]) return 1;
  return 0;
}
long long notinString(char c, string s) {
  for (long long i = 0; i <= s.size() - 1; i++)
    if (c == s[i]) return 0;
  return 1;
}
string solve(string s, string res) {
  string ans = "";
  for (long long i = 0; i <= s.size() - 1; i++) {
    if (inString(s[i], res)) {
      ans += s[i];
    }
  }
  return ans;
}
void update(string s) {
  for (long long i = 'a'; i <= 'z'; i++) {
    if (check[i] == 0) {
      if (notinString(i, s)) check[i] = 1;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  long long cnt = 0;
  for (long long i = 'a'; i <= 'z'; i++) tmp[i] = 1;
  for (long long i = 1; i <= n; i++) {
    cin >> c;
    cin >> s;
    if (i < n) {
      if (c == '.') {
        for (long long j = 0; j <= s.size() - 1; j++) {
          check[s[j]] = 1;
        }
      }
      if (c == '?') {
        if (calc() == 1) cnt++;
        check[s[0]] = 1;
      }
      if (c == '!') {
        if (calc() == 1) cnt++;
        res = solve(s, res);
        update(res);
      }
    }
  }
  cout << cnt;
  return 0;
}
