#include <bits/stdc++.h>
using namespace std;
mt19937 rnd((uint64_t) new char);
int64_t rand(int64_t x, int64_t y) { return rnd() % (y - x + 1) + x; }
template <typename t>
t min(t a) {
  return a;
}
template <typename t, typename... ts>
t min(const t &a, const ts &...as) {
  t tmp = min(as...);
  return tmp < a ? tmp : a;
}
template <typename t>
t max(t a) {
  return a;
}
template <typename t, typename... ts>
t max(const t &a, const ts &...as) {
  t tmp = max(as...);
  return tmp > a ? tmp : a;
}
void prn(ostream &os) { os << '\n'; }
void prn() { cout << '\n'; }
template <typename t, typename... ts>
void prn(ostream &os, const t &a, const ts &...b) {
  os << a << ' ';
  prn(os, b...);
}
template <typename t, typename... ts>
void prn(const t &a, const ts &...b) {
  cout << a << ' ';
  prn(cout, b...);
}
template <typename... ts>
void deb(const ts &...b) {}
using vi = vector<int>;
using vll = vector<int64_t>;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
using ll = int64_t;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  unordered_set<char> can_be;
  int ans = 0;
  char win = 0;
  for (char i = 'a'; i <= 'z'; i++) can_be.insert(i);
  for (int i = 0; i < n; i++) {
    char type;
    string s;
    cin >> type >> s;
    if (win != 0) {
      if (type == '.') continue;
      if (type == '?') ans += (s[0] != win);
      if (type == '!') ans++;
      continue;
    }
    if (type == '.') {
      for (char c : s) can_be.erase(c);
    }
    if (type == '!') {
      unordered_set<char> in_s;
      for (char c : s) in_s.insert(c);
      unordered_set<char> new_can_be;
      for (char j : can_be)
        if (in_s.count(j)) new_can_be.insert(j);
      swap(new_can_be, can_be);
    }
    if (type == '?') {
      if (i != n - 1) can_be.erase(s[0]);
    }
    if (can_be.size() == 1) win = *can_be.begin();
  }
  cout << ans << '\n';
}
