#include <bits/stdc++.h>
using namespace std;
int n;
bool possible[26], tmp[26], first = true;
int main() {
  cin >> n;
  int cnt = 0;
  for (int x = 0, qwert = 26; x < qwert; x++) possible[x] = 1;
  for (int x = 0, qwert = n - 1; x < qwert; x++) {
    char c;
    string w;
    cin >> c >> w;
    memset(tmp, 0, sizeof(tmp));
    for (char i : w) tmp[i - 'a'] = 1;
    if (c == '!') {
      if (count(possible, possible + 26, 1) == 1) cnt++;
      for (int y = 0, qwert = 26; y < qwert; y++) possible[y] &= tmp[y];
    } else if (c == '.') {
      for (int y = 0, qwert = 26; y < qwert; y++) possible[y] &= 1 - tmp[y];
    } else {
      if (count(possible, possible + 26, 1) == 1) cnt++;
      possible[w[0] - 'a'] = 0;
    }
  }
  cout << cnt << "\n";
}
