#include <bits/stdc++.h>
using namespace std;
inline long long gcd(long long a, long long b) {
  while (b) {
    a %= b, swap(a, b);
  }
  return a;
}
inline long long lcm(long long a, long long b) {
  return a * b / max(1LL, gcd(a, b));
}
mt19937 Random((long long)time(0));
inline long long rnd(long long x) { return Random() % x; }
const long long INF = (long long)1e9 + 2017;
const long long MOD = (long long)1e9 + 7;
const long double EPS = 1e-10;
const long double PI = acos(-1.0);
const long long N = 1e5 + 10;
bool w[26];
void source() {
  long long n;
  cin >> n;
  long long kol = 26, ans = 0;
  for (long long i = 0; i < n; i++) {
    char c;
    string s;
    cin >> c >> s;
    if (kol > 1) {
      if (c == '!') {
        bool res[26];
        memset(res, 0, sizeof(res));
        for (char x : s) {
          res[x - 'a'] = 1;
        }
        for (long long j = 0; j < 26; j++) {
          if (!res[j]) {
            kol -= w[j] ^ 1;
            w[j] = 1;
          }
        }
      }
      if (c == '.') {
        for (char x : s) {
          kol -= w[x - 'a'] ^ 1;
          w[x - 'a'] = 1;
        }
      }
      if (c == '?') {
        if (i != n - 1) {
          char res = s[0];
          kol -= w[res - 'a'] ^ 1;
          w[res - 'a'] = 1;
        }
      }
    } else {
      if (c == '!') {
        ans++;
      }
      if (c == '?' && i != n - 1) {
        ans++;
      }
    }
  }
  cout << ans;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios_base::fixed, ios_base::floatfield);
  cout.precision(10);
  source();
}
