Example

Input

3
y 7
y 6
n 5


Output

1
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N;
	vector<char>c(N);
	vector<int>v(N);
	vector<pair<int, int>>vp;
	for (int i = 0; i < N; i++) {
		cin >> c[i] >> v[i];
		if (c[i] == 'y') {
			vp.push_back({ v[i],i });
		}
	}
	int ans = 0;
	sort(vp.begin(), vp.end());
	vector<int>used(N);
	for (auto i : vp) {
		if (used[i.second])continue;
		ans++;
		int l = i.second, r = i.second;
		while (l>=0) {
			if (v[l] >= i.first&&c[l]=='y') {
				used[l] = 1;
				l--;
				continue;
			}
			else if (v[l] >= i.first&&c[l] == 'n') {
				break;
			}
			else {
				l--;
			}
		}
		while (r < N) {
			if (v[r] >= i.first&&c[r] == 'y') {
				used[r] = 1;
				r++;
				continue;
			}
			else if (v[r] >= i.first&&c[r] == 'n') {
				break;
			}
			else {
				r++;
			}
		}
	}
	cout << ans << endl;
}
