#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
template <typename T>
std::string NumberToString(T Number) {
  std::ostringstream ss;
  ss << Number;
  return ss.str();
}
int biton(int N, int pos) { return N = N | (1 << pos); }
int bitoff(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
int test;
string op, word;
unordered_set<char> store;
map<int, int> Rank;
int main() {
  cin >> test;
  int cnt = 0;
  for (int i = 0; i < 26; i++) {
    Rank[i] = 0;
    store.insert('a' + i);
  }
  for (int i = 0; i < test - 1; i++) {
    cin >> op >> word;
    if (store.size() == 1) {
      if (op == "!")
        cnt++;
      else if (op == "?" and word[0] != *store.begin())
        cnt++;
      else
        continue;
    }
    if (op == "!") {
      bool ar[123];
      memset(ar, false, sizeof(ar));
      for (auto x : word) {
        ar[x - 'a'] = true;
      }
      for (int x = 0; x < 26; x++) {
        auto id = store.find('a' + x);
        if (ar[x] == false and id != store.end()) {
          store.erase(id);
          Rank[x] = 2;
        }
      }
    } else if (op == ".") {
      int sz = word.size();
      for (int x = 0; x < sz; x++) {
        auto id = store.find(word[x]);
        if (id != store.end()) {
          store.erase(id);
          Rank[x] = 2;
        } else
          Rank[x] = 2;
      }
    } else if (op == "?") {
      store.erase(word[0]);
    }
  }
  cin >> op >> word;
  cout << cnt << endl;
  return 0;
}
