#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
constexpr int INF = 0x3f3f3f3f;
constexpr ll LLINF = 0x3f3f3f3f3f3f3f3f;
template <class RIt>
void dbarr(RIt frs, RIt lst) {
  cerr << "arr: ";
  for (int i = 0; i < (int)(lst - frs); i++)
    cerr << frs[i] << " \n"[i == (int)(lst - frs) - 1];
}
int n;
bool possible[30], cur[30], done = 0, last[30];
int extra = 0;
int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin >> n;
  memset(possible, 1, sizeof possible);
  for (int i = 0; i < n; i++) {
    char t;
    cin >> t;
    string s;
    cin >> s;
    if (i == n - 1) continue;
    if (t == '!') {
      memset(cur, 0, sizeof cur);
      for (char& c : s) {
        cur[c - 'a'] = 1;
      }
      if (done) extra++;
      for (int i = 0; i < 26; i++) {
        possible[i] &= cur[i];
      }
    }
    if (t == '.') {
      for (char& c : s) possible[c - 'a'] = 0;
    }
    if (t == '?') {
      if (t != n - 1) {
        possible[s[0] - 'a'] = 0;
        if (done) extra++;
      }
    }
    int cnt = 0;
    for (int i = 0; i < 26; i++) cnt += possible[i];
    if (cnt == 1) {
      done = 1;
    }
  }
  cout << extra << "\n";
}
