#include <stdio.h>
struct Point {
int x, y;
};
int isInside(struct Point polygon[], int n, struct Point p) {
int count = 0, i, next;
for (i = 0; i < n; i++) {
next = (i + 1) % n;
if (p.y > polygon[i].y && p.y <= polygon[next].y || p.y > polygon[next].y && p.y <= polygon[i].y) {
if (p.x <= (polygon[next].x - polygon[i].x) * (p.y - polygon[i].y) / (polygon[next].y - polygon[i].y) + polygon[i].x)
count++;
}
}
return count % 2;
}
int main() {
int n, i;
struct Point polygon[1000], p;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d %d", &polygon[i].x, &polygon[i].y);
}
scanf("%d %d", &p.x, &p.y);
if (isInside(polygon, n, p))
printf("YES\n");
else
printf("NO\n");
return 0;
}