import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

void main() {
    int n;
    scan(n);

    int ans;
    int set = (1<<26) - 1;
    bool safe;

    foreach (i ; 0 .. n-1) {
        char e;
        string s;
        scan(e, s);

        if (safe && e != '.') {
            ans++;
            continue;
        }

        int t;

        if (e == '!') {
            foreach (ch ; s) {
                t |= (1<<(ch - 'a'));
            }
        }
        else if (e == '.') {
            t = (1<<26) - 1;
            foreach (ch ; s) {
                t &= ~(1<<(ch - 'a'));
            }
        }
        else {
            t = ~(1<<(s[0] - 'a'));
        }

        set &= t;

        debug {
            writefln("%b",set);
        }

        if (set.popcnt == 1) {
            safe = 1;
        }
    }

    writeln(ans);
}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}