#include <bits/stdc++.h>
int m, n, t;
bool f[1002];
char h[1000], d[1000];
int solve() {
  for (int i = 0; i < n; i++) f[i] = true;
  int t, inc;
  for (int i = 0; i < m; i++) {
    scanf("%s %s %s %s %d", d, d, h, d, &t);
    t--;
    if (h[0] == 'r') {
      for (int j = 0; j <= t; j++) f[j] = false;
    } else {
      for (int j = t; j < n; j++) f[j] = false;
    }
  }
  int c = 0;
  for (int i = 0; i < n; i++) c += f[i];
  return c == 0 ? -1 : c;
}
int main() {
  scanf("%d %d", &n, &m);
  printf("%d\n", solve());
  return 0;
}
