#include <bits/stdc++.h>
using namespace std;
int no[26];
int cnt[26];
int main() {
  int n;
  cin >> n;
  int total = 0, ans = 0, pos = 26;
  for (int i = 1; i <= n; i++) {
    string a, b;
    cin >> a >> b;
    if (a[0] == '.') {
      for (int j = 0; j < b.length(); j++) {
        no[b[j] - 'a'] = 1;
      }
    } else if (a[0] == '!') {
      if (pos == 1) {
        ans++;
      }
      set<int> st;
      total++;
      for (int j = 0; j < b.length(); j++) {
        st.insert(b[j] - 'a');
      }
      for (auto x : st) {
        cnt[x]++;
      }
    } else {
      if (pos == 1) {
        ans++;
      }
      no[b[0] - 'a'] = 1;
    }
    pos = 0;
    for (int j = 0; j < 26; j++) {
      if (no[j]) {
        continue;
      }
      if (cnt[j] == total) {
        pos++;
      }
    }
  }
  cout << max(0, ans - 1) << '\n';
  return 0;
}
