#include <bits/stdc++.h>
using namespace std;
int inf = 1000000009;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, k, l, p;
  cin >> n;
  int c[40] = {};
  int err = 0;
  int anss = 0;
  set<int> second;
  for (int i = 0; i <= 'z' - 'a'; i++) second.insert(i);
  int per = 0;
  for (int y = 0; y < n; y++) {
    string q, prob;
    char s;
    cin >> s >> q;
    if ((s == '!' || s == '?') && err == 1) {
      if (y != n - 1) anss++;
      continue;
    }
    if (s == '!') {
      {
        set<int> q1;
        for (int i = 0; i < q.length(); i++)
          if (second.count(q[i] - 'a')) q1.insert(q[i] - 'a');
        second = q1;
      }
    } else if (s == '.') {
      set<int> pro;
      for (auto i : second) {
        int er = 0;
        for (int j = 0; j < q.length(); j++)
          if (i == q[j] - 'a') {
            er = 1;
            break;
          }
        if (!er) pro.insert(i);
      }
      second = pro;
    } else {
      if (second.count(q[0] - 'a')) {
        set<int> pro;
        for (auto i : second)
          if (i != q[0] - 'a') pro.insert(i);
        second = pro;
      }
    }
    int ind, ans = 0;
    if (second.size() == 1) err = 1;
  }
  cout << anss;
}
