#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(long long a, long long n) {
  long long r = 1 % P;
  for (a %= P; n; a = a * a % P, n >>= 1)
    if (n & 1) r = r * a % P;
  return r;
}
void exgcd(long long a, long long b, long long &d, long long &first,
           long long &second) {
  b                          ? exgcd(b, a % b, d, second, first),
      second -= a / b *first : first = 1, second = 0, d = a;
}
long long inv(long long first) {
  return first <= 1 ? 1 : inv(P % first) * (P - P / first) % P;
}
const int N = 4e5 + 10;
int a[N], b[N], c[N], vis[N], f[N], n, m, k, t;
vector<int> g[N];
int main() {
  std::ios::sync_with_stdio(false);
  ;
  cin >> n;
  int ok = 0;
  for (int i = 1; i <= n - 1; ++i) {
    string op, s;
    cin >> op >> s;
    if (op[0] == '!') {
      if (ok)
        ++m;
      else {
        for (int i = 'a'; i <= 'z'; ++i) vis[i] = 0;
        for (auto c : s) vis[c] = 1;
        for (int i = 'a'; i <= 'z'; ++i) f[i] |= !vis[i];
      }
    } else if (op[0] == '.') {
      for (auto c : s) f[c] = 1;
    } else
      m += ok, f[s[0]] = 1;
    int sum = 0;
    for (int i = 'a'; i <= 'z'; ++i) sum += f[i];
    if (sum == 25) ok = 1;
  }
  cout << m << '\n';
}
