#include "bits/stdc++.h"
using namespace std;

#define rep(i,a,b) for(int i = (a); i < (b); ++i)
#define all(x) begin(x),end(x)
#define sz(x) int(x.size())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
const int N = 1e6+1;
typedef bitset<N> B;
int main(){
    cin.tie(0)->sync_with_stdio(0);
    int n; cin >> n;
    struct op {
        bool add;
        int v;
        bool async;
        void read() {
            char c; 
            cin >> c >> v;
            add=c=='+';
            string s; cin >> s;
            async = s=="async";
        }
    };
    vector<op> ops(n);
    for(auto& i : ops) i.read();
    B ans;
    B dp = {}, dp2 = {};
    dp[0]=1;
    int last=n-1;
    while(last>=0 and ops[last].add) --last;
    vi mine;
    int sum=0;
    for(int i=0;i<n;++i) if(ops[i].add) sum+=ops[i].v;
    if(last==-1) {
        cout << "1\n";
        exit(0);
    }
    for(int i=0;i<n;++i) {
        auto& o = ops[i];
        if(o.add) {
            
            if(o.async) {
                dp|=dp<<o.v;
                dp2|=dp2<<o.v;
            }
            sum-=o.v;
        } else {
            if(o.async) {
                dp2|=dp<<(o.v);
            }
        }
        if(i==last) {
            ans|=dp<<(sum+o.v);
        }
        if(i>=last) {
            ans|=dp2<<(sum);
        }
    }
    cout << ans.count() << '\n';

}