#include <bits/stdc++.h>
using namespace std;
int a[1001];
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  while (cin >> n >> m) {
    memset(a, 0, sizeof(a));
    string s, t;
    int x;
    int l = 0, r = n - 1;
    for (int k = (0); k < ((m)); ++k) {
      cin >> s >> s >> s >> t >> x;
      x--;
      a[x]++;
      if (s == "left")
        r = min(r, x);
      else
        l = max(l, x);
    }
    int c = 0;
    for (int i = (l); i < (r + 1); ++i)
      if (!a[i]) c++;
    if (c == 0)
      cout << -1 << endl;
    else
      cout << c << endl;
  }
  return 0;
}
