#include <bits/stdc++.h>
using namespace std;
struct rule {
  int x, y;
  int sign;
};
int n, k;
const int max_n = 35, max_k = 100;
rule List[max_k];
long long dp[max_n][2 * max_n][2 * max_n];
const int Equals = 0, Less = 1, LessOrEquals = 2;
bool check(const int tmp[], int a, int b) {
  for (int i = 0; i < (k); i++)
    if (List[i].x == a || List[i].y == a || List[i].x == b || List[i].y == b) {
      if (List[i].sign == Equals) {
        if (tmp[List[i].x] != tmp[List[i].y]) return false;
      } else if (List[i].sign == Less) {
        if (tmp[List[i].x] >= tmp[List[i].y]) return false;
      } else if (List[i].sign == LessOrEquals) {
        if (tmp[List[i].x] > tmp[List[i].y]) return false;
      }
    }
  return true;
}
long long find(int i, int b, int e) {
  if (i == n) return 1;
  if (dp[i][b][e] != -1) return dp[i][b][e];
  dp[i][b][e] = 0;
  int tmp[2 * n];
  memset(tmp, 0, sizeof tmp);
  for (int j = (b + 1); j < (e); j++) tmp[j] = 2;
  tmp[b] = tmp[e] = 1;
  if (check(tmp, b, e)) dp[i][b][e] += find(i + 1, b + 1, e - 1);
  tmp[b] = tmp[e] = 2;
  if (i < n - 1) {
    tmp[b] = tmp[b + 1] = 1;
    if (check(tmp, b, b + 1)) dp[i][b][e] += find(i + 1, b + 2, e);
    tmp[b] = tmp[b + 1] = 2;
    tmp[e] = tmp[e - 1] = 1;
    if (check(tmp, e, e - 1)) dp[i][b][e] += find(i + 1, b, e - 2);
  }
  return dp[i][b][e];
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < (k); i++) {
    string sign;
    cin >> List[i].x >> sign >> List[i].y;
    List[i].x--, List[i].y--;
    if (sign == "=")
      List[i].sign = Equals;
    else if (sign == "<")
      List[i].sign = Less;
    else if (sign == "<=")
      List[i].sign = LessOrEquals;
    else if (sign == ">") {
      swap(List[i].x, List[i].y);
      List[i].sign = Less;
    } else if (sign == ">=") {
      swap(List[i].x, List[i].y);
      List[i].sign = LessOrEquals;
    }
  }
  memset(dp, -1, sizeof dp);
  cout << find(0, 0, 2 * n - 1) << endl;
  return 0;
}
