#include <bits/stdc++.h>
using namespace std;
int poss[27] = {};
int cnt = 0, ans = 0;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    if (cnt == 1) {
      char stat;
      string tmp;
      cin >> stat >> tmp;
      if (stat != '.' && i != n - 1) ans++;
    } else if (cnt != 1) {
      char stat;
      cin >> stat;
      if (stat == '.') {
        string tmp;
        cin >> tmp;
        for (int j = 0; j < tmp.length(); j++) poss[tmp[j] - 'a'] = 1;
      } else if (stat == '?' && i != n - 1) {
        char tmp;
        cin >> tmp;
        poss[tmp - 'a'] = 1;
      } else if (stat == '!') {
        string tmp;
        cin >> tmp;
        for (int k = 0; k < 26; k++) {
          int flag = 0;
          if (poss[k] == 0)
            for (int j = 0; j < tmp.length(); j++)
              if (k == tmp[j] - 'a') flag = 1;
          if (flag == 0) poss[k] = 1;
        }
      }
      cnt = 0;
      for (int j = 0; j < 26; j++) {
        if (poss[j] == 0) cnt++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
