#include <bits/stdc++.h>
using namespace std;
bitset<26> ans, tmp;
int n, cnt = 0;
char ch;
string s;
int main() {
  ans.set();
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ch >> s;
    if (ans.count() == 1 && i < n && ch != '.') cnt++;
    {
      tmp.reset();
      for (int i = 0; i <= s.length(); i++) tmp[s[i] - 'a'] = 1;
      if (ch == '!')
        ans &= tmp;
      else
        ans &= ~tmp;
    }
  }
  cout << cnt << endl;
}
