#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
using namespace std;
const int DIM=100000;
char buff[DIM];
int poz=DIM-1;
template <typename T>
void fastRead(T &nr)
{
nr = 0;
while(!('0'<=buff[poz]&&buff[poz]<='9'))
{
if(++poz==DIM)
{
fread(buff,1,DIM,stdin);
poz=0;
}
}
while('0'<=buff[poz]&&buff[poz]<='9')
{
nr = nr*10 + buff[poz]-'0';
if(++poz==DIM)
{
fread(buff,1,DIM,stdin);
poz=0;
}
}
}
typedef long long int ll;
typedef pair<ll, ll> pll;
ll get_determinator(const pll &a, const pll &b) {
return (a.first * b.second - a.second * b.first);
}
ll get_orient_value(const pll &a, const pll &b, const pll &c) {
return get_determinator(a, b) + get_determinator(b, c) + get_determinator(c, a);
}
int orient(const pll &a, const pll &b, const pll &c) {
ll x = get_orient_value(a, b, c);
if (x > 0)
return 1;
if (x < 0)
return -1;
return 0;
}
vector<pll> vertices;
vector<pair<pll, pll>> edges;
void read_input(int &n, int &m) {
fastRead(n);
fastRead(m);
for (int i = 1; i <= n; i++) {
pll x;
fastRead(x.first);
fastRead(x.second);
vertices.push_back(x);
}
for (int i = 0, j = n - 1; i < n; j = i++)
edges.push_back({vertices[j], vertices[i]});
sort(edges.begin(), edges.end(), [](const pair<pll, pll> &e1, const pair<pll, pll> &e2) {
return min(e1.first.second, e1.second.second) < min(e2.first.second, e2.second.second);
});
}
int query(const int &n, const pll &p) {
int intersections = 0;
for (int i = 0; i < n; i++) {
const pll &a = edges[i].first;
const pll &b = edges[i].second;
if (min(a.second, b.second) > p.second)
break;
if (p.second > max(a.second, b.second))
continue;
int o = orient(a, b, p);
if (o == 0 && min(a.first, b.first) <= p.first && p.first <= max(a.first, b.first))
return 0;
if ((a.second > p.second) != (b.second > p.second)) {
int s = (a.second < b.second) ? o : -o;
if (s > 0) intersections++;
}
}
return (intersections % 2 == 0) ? -1 : 1;
}
void solve_queries(const int &n, const int &m) {
int x = 0;
for (int _ = 1; _ <= m; _++) {
pll point;
fastRead(point.first);
fastRead(point.second);
int result = query(n, point);
x += (result == 1 || result == 0);
}
printf("%d\n", x);
}
int main() {
freopen("poligon.in", "r", stdin);
freopen("poligon.out", "w", stdout);
int n, m;
read_input(n, m);
solve_queries(n, m);
return 0;
}