import java.io.*;
import java.util.*;

public class twocaptains_pk_no_compression {

	class RangeTree {
		int MAXN = 1000;

		int[] part = new int[MAXN];
		int[] a = new int[MAXN];

		void set(int l, int r, int x) {
			for (int i = l; i <= r; i++) {
				a[i] = x;
			}
			for (int i = l; i < MAXN; i++) {
				part[i] = a[i];
				if (i > 0)
					part[i] += part[i - 1];
			}
		}

		int get(int l, int r) {
			int ans = part[r];
			if (l > 0)
				ans -= part[l - 1];
			return ans;
		}

	}

	class Command {
		String type;
		int l, r;

		Command() throws NumberFormatException, IOException {
			type = nextToken();
			if (!type.equals("rum")) {
				l = nextInt() - 1;
				r = nextInt() - 1;
			}
		}
	}

	void solve() throws IOException {
		nextInt();

		int n = nextInt();
		Command[] a = new Command[n];
		for (int i = 0; i < n; i++) {
			a[i] = new Command();
		}

		int m = nextInt();
		Command[] b = new Command[m];
		for (int i = 0; i < m; i++) {
			b[i] = new Command();
		}

		boolean[][] canFirst = new boolean[n][m + 1];
		RangeTree second = new RangeTree();
		for (int j = 0; j <= m; j++) {
			if (j > 0 && b[j - 1].type.equals("send"))
				second.set(b[j - 1].l, b[j - 1].r, 1);
			if (j > 0 && b[j - 1].type.equals("back"))
				second.set(b[j - 1].l, b[j - 1].r, 0);
			for (int i = 0; i < n; i++) {
				if (!a[i].type.equals("send")
						|| second.get(a[i].l, a[i].r) == 0) {
					canFirst[i][j] = true;
				}
			}
		}
		//for (int i = 0; i < n; i++)
			//System.err.println(Arrays.toString(canFirst[i]));

		boolean[][] canSecond = new boolean[n + 1][m];
		RangeTree first = new RangeTree();
		for (int i = 0; i <= n; i++) {
			if (i > 0 && a[i - 1].type.equals("send"))
				first.set(a[i - 1].l, a[i - 1].r, 1);
			if (i > 0 && a[i - 1].type.equals("back"))
				first.set(a[i - 1].l, a[i - 1].r, 0);
			for (int j = 0; j < m; j++) {
				if (!b[j].type.equals("send") || first.get(b[j].l, b[j].r) == 0)
					canSecond[i][j] = true;
			}
		}
		//for (int i = 0; i <= n; i++)
			//System.err.println(Arrays.toString(canSecond[i]));

		int[][] dp = new int[n + 1][m + 1];
		for (int i = 0; i <= n; i++) {
			for (int j = 0; j <= m; j++) {
				dp[i][j] = Integer.MAX_VALUE / 2;
			}
		}

		dp[0][0] = 0;
		for (int i = 0; i <= n; i++) {
			for (int j = 0; j <= m; j++) {
				if (i < n && canFirst[i][j])
					dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j]
							+ (j == m ? 0 : 1));
				if (j < m && canSecond[i][j])
					dp[i][j + 1] = Math.min(dp[i][j + 1], dp[i][j]
							+ (i == n ? 0 : 1));
				if (i < n && j < m && canFirst[i][j + 1] && canSecond[i + 1][j])
					dp[i + 1][j + 1] = Math.min(dp[i + 1][j + 1], dp[i][j]);
			}
		}
		//for (int i = 0; i <= n; i++)
			//System.err.println(Arrays.toString(dp[i]));

		out.println(dp[n][m]);
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;

	void run() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);

			br = new BufferedReader(new FileReader(new File("twocaptains.in")));
			out = new PrintWriter("twocaptains.out");

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		new twocaptains_pk_no_compression().run();
	}

	String nextToken() throws IOException {
		while ((st == null) || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}

	double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}

	long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(nextToken());
	}
}
