#include #include #include #include #include using namespace std; #define Max_N 500+10 #define INF 0x3f3f3f3f int n, m; struct point{ int x, y; }; point p_n[Max_N]; point p_m[Max_N]; int G[Max_N][Max_N]; int multi(point p1, point p2, point p0) { int ans = (p1.x - p0.x) * (p2.y - p0.y) - (p2.x - p0.x) * (p1.y - p0.y); if (ans > 0) return 1; if (ans == 0) return 0; if (ans < 0) return 2; } int main() { while (scanf("%d", &n) != EOF) { memset(G, INF, sizeof(G)); for (int i = 1; i <= n; i++) scanf("%d%d", &p_n[i].x, &p_n[i].y); scanf("%d", &m); for (int i = 1; i <= m; i++) scanf("%d%d", &p_m[i].x, &p_m[i].y); int flag = 4; int flag1 = 0; for (int i = 1; i <= m; i++) for (int j = i+1; j <= m; j++) { flag1 = 0; flag = 4; for (int k = 1; k <= n; k++) { int mu = multi(p_n[k], p_m[i], p_m[j]); if (mu == 0) { if (min(p_m[i].x, p_m[j].x) <= p_n[k].x && max(p_m[i].x, p_m[j].x) >= p_n[k].x) continue; else { flag1 = 1; break; } } if (flag == 4) { flag = mu; } else { if (flag != mu) { flag1 = 1; break; } } } if (!flag1) { if (flag == 1 || flag == 4) G[j][i] = 1; if (flag == 2 || flag == 4) G[i][j] = 1; } } int ans = INF; for(int k=1;k<=m;k++) { for(int i=1;i<=m;i++) { if(G[i][k]==INF) continue; for(int j=1;j<=m;j++) G[i][j] = min(G[i][j], G[i][k]+G[k][j]); } } for(int i=1;i<=m;i++) ans = min(ans, G[i][i]); if(ans > m) printf("ToT\n"); else printf("%d\n", m-ans); } return 0; }