#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, l, n, m, it = 0, ar[26], flag = -1, cnt = 0;
  cin >> n;
  int ans = 0;
  char c;
  string second;
  for (i = 0; i < 26; i++) ar[i] = 1;
  for (i = 0; i < n; i++) {
    cin >> c >> second;
    if (i == n - 1) break;
    if (flag == 1) {
      if (c != '.') ans++;
      continue;
    }
    if (c == '.')
      for (j = 0; j < second.size(); j++) ar[second[j] - 'a'] = 0;
    else if (c == '!') {
      map<int, bool> mapp;
      for (j = 0; j < second.size(); j++) mapp[second[j] - 'a'] = 1;
      for (j = 0; j < 26; j++)
        if (ar[j] == 1 && mapp[j])
          ;
        else
          ar[j] = 0;
    } else
      ar[second[0] - 'a'] = 0;
    int cnt = 0;
    for (j = 0; j < 26; j++) cnt += ar[j];
    if (cnt == 1) flag = 1;
  }
  cout << ans << endl;
  return 0;
}
