#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long long M = 1e9 + 7;
template <typename T>
void print(vector<T>& v) {
  cout << "[";
  for (int i = 0; i < v.size(); ++i) {
    cout << v[i];
    if (i != v.size() - 1) cout << ", ";
  }
  cout << "]\n";
}
template <typename T>
void print(set<T>& v) {
  cout << "[";
  for (auto it : v) {
    cout << it;
    if (it != *v.rbegin()) cout << ", ";
  }
  cout << "]\n";
}
template <typename T, typename S>
void print(map<T, S>& v) {
  for (auto it : v) cout << it.first << " : " << it.second << "\n";
}
template <typename T, typename S>
void print(pair<T, S>& v) {
  cout << "( " << v.first << ", " << v.second << " )" << '\n';
}
template <typename T>
void print(T x) {
  cout << x << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  vector<int> cpos(26, 1);
  int ans = 0;
  bool done = 0;
  int n;
  cin >> n;
  while (n--) {
    char t;
    cin >> t;
    string s;
    cin >> s;
    set<char> cs;
    for (int i = 0; i < s.size(); i++) cs.insert(s[i]);
    if (n == 0) {
      break;
    }
    if (t == '.') {
      for (char c : cs) {
        cpos[c - 'a'] = 0;
      }
    } else if (t == '!') {
      if (done) {
        ans++;
      }
      for (char c = 'a'; c <= 'z'; c++) {
        if (!cs.count(c)) {
          cpos[c - 'a'] = 0;
        }
      }
    } else {
      if (done) {
        ans++;
      }
      cpos[s[0] - 'a'] = 0;
    }
    int sm = 0;
    for (int i = 0; i < 26; i++) {
      sm += cpos[i];
    }
    if (sm == 1) {
      done = 1;
    }
  }
  cout << ans << '\n';
}
