#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;
const long long int INF = 1e18;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 5;
int cas = 1;
void solve() {
  int n;
  while (~scanf("%d", &n)) {
    bitset<26> vis, tmp;
    vis.set();
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      string op, s;
      cin >> op >> s;
      if (vis.count() == 1) {
        if (i == n) continue;
        ans += (op != ".");
      }
      tmp.reset();
      for (int j = 0; j < s.size(); j++) {
        tmp[s[j] - 'a'] = 1;
      }
      if (op == "!")
        vis &= tmp;
      else if (op == "." || (op == "?" && i != n))
        vis &= ~tmp;
    }
    cout << ans << endl;
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
