#include <bits/stdc++.h>
using namespace std;
priority_queue<int, vector<int>, greater<int> > A;
priority_queue<int> B, C;
const int mod = 1e9 + 7;
int _pow(int x, int n) {
  int ret = 1;
  for (; n; n >>= 1, x = 1LL * x * x % mod)
    if (n & 1) ret = 1LL * ret * x % mod;
  return ret;
}
int cnt;
inline bool del(int x) {
  if (!A.empty() && x > A.top()) return false;
  if (!B.empty() && x < B.top()) return false;
  if (!A.empty() && x == A.top()) {
    A.pop();
    while (!C.empty()) B.push(C.top()), C.pop();
    return true;
  }
  if (!B.empty() && x == B.top()) {
    B.pop();
    while (!C.empty()) A.push(C.top()), C.pop();
    return true;
  }
  ++cnt;
  while (C.top() != x) A.push(C.top()), C.pop();
  C.pop();
  while (!C.empty()) B.push(C.top()), C.pop();
  return true;
}
inline void insert(int x) {
  if (!A.empty() && x > A.top()) {
    A.push(x);
    return;
  }
  if (!B.empty() && x < B.top()) {
    B.push(x);
    return;
  }
  C.push(x);
}
int n;
char s[100];
int main() {
  scanf("%d", &n);
  for (register int i = 1, x; i <= n; ++i) {
    scanf("%s%d", s, &x);
    if (s[1] == 'C' && !del(x))
      return puts("0"), 0;
    else if (s[1] == 'D')
      insert(x);
  }
  int t = C.size() + 1;
  printf("%d\n", 1LL * t * _pow(2, cnt) % mod);
  return 0;
}
