#include <bits/stdc++.h>
using namespace std;
int const bound = 1e6 + 2, N = 5e5 + 2;
long long OO = 1e18;
double eps = 1e-6;
int oo = 1e9, mod = oo + 7;
pair<char, string> qq[N];
int main() {
  int n, sh = 0;
  cin >> n;
  for (int(i) = 0; (i) < (n); (i)++) {
    char e;
    string w;
    cin >> e >> w;
    qq[i] = {e, w};
    if (e != '.') sh++;
  }
  int got = 0;
  int cc[26] = {};
  for (int(i) = 0; (i) < (n); (i)++) {
    char e = qq[i].first;
    string w = qq[i].second;
    int h = 0;
    if (e == '.')
      for (auto c : w) cc[c - 'a'] = -1;
    else if (e == '!') {
      got++;
      int in[26] = {};
      for (auto c : w) in[c - 'a'] = 1;
      for (int(j) = 0; (j) < (26); (j)++)
        if (!in[j]) cc[j] = -1;
      for (auto c : w)
        if (cc[c - 'a'] == 0) cc[c - 'a'] = 1;
    } else {
      got++;
      if (i == n - 1) {
        cout << 0 << endl;
        return 0;
      }
      cc[w[0] - 'a'] = -1;
    }
    for (int(j) = 0; (j) < (26); (j)++)
      if (cc[j] == 1) h++;
    if (h == 1) {
      got++;
      break;
    }
    h = 0;
    for (int(j) = 0; (j) < (26); (j)++)
      if (cc[j] == -1) h++;
    if (h == 25) {
      got++;
      break;
    }
  }
  cout << sh - got << endl;
  return 0;
}
