object Main extends App {
  import scala.io.StdIn._


  val efs: Double = 0.000000001d

  solve
  def solve: Unit = {
    val n = readInt
    if (n == 0) return
    val Array(x, y) = readLine.trim.split(' ').map(_.toInt)
    val points = Array.tabulate(n){_ ⇒
      val Array(x, y) = readLine.trim.split(' ').map(_.toInt)
      Point(x, y)
    }
    val edges = Array.tabulate(n){i ⇒
      Edge(points(i), points((i + 1) % n))
    }
    println(calPattern(edges, Point(x, y)))
    solve
  }

  def calPattern(edges: Array[Edge], origin: Point): Int = {
    def sub(current: IndexedSeq[Edge], use: Flag, prev: List[Edge]): Int = {
      if (use.indices.isEmpty)
        if (isOnLine(prev, origin)) 1
        else 0
      else {
        use.indices.map(i ⇒ sub(current.map(e ⇒ current(i).flip(e)), use.added(i), current(i).shrink::prev)).sum
      }
    }
    sub(edges, new Flag(edges.length), Nil)
  }
  class Flag(private[this] val size: Int, private[this] val flag: Int = 0) {
    def added(idx: Int): Flag = new Flag(size, flag | (1 << idx))
    def indices = (0 until size).filter(i ⇒ ((1 << i) & flag) == 0)
  }
  def isOnLine(edges: Seq[Edge], origin: Point): Boolean = {
    val mapped = edges.map{case Edge(f, t) ⇒ (Angle(f - origin), Angle(t - origin))}.toArray
    for (i ← mapped.indices){
      val base = mapped(i)._1
      val rotate = mapped.map{case (lower, upper) ⇒ (lower - base, upper - base)}
      if (rotate.forall{case (lower, upper) ⇒ lower.sin < efs && upper.sin > -efs})
        return true
    }
    false
  }
  case class Edge(from: Point, to: Point) {
    def shrink: Edge = {
      val a = Angle(to - from)
      Edge(from + Point(a.cos / 1000000, a.sin / 1000000), to - Point(a.cos / 1000000, a.sin / 1000000))
    }
    def flip(that: Edge): Edge = {
      Edge(flip(that.to), flip(that.from))
    }
    private[this] def flip(that: Point): Point = {
      val line = Line(from, to)
      val l = Line(that, line.angle.rotate90)
      l.crossPoint(line).get.let(c ⇒ c - that + c)
    }
  }
  object Line {
    def apply(point: Point, angle: Angle): Line = {
      //cos(y - p.y) == sin(x - p.x)
      new Line(-angle.sin, angle.cos, angle.sin * point.x - angle.cos * point.y)
    }
    def apply(a: Point, b: Point): Line = {
      //(a.x - b.x)(y - b.y) == (a.y - b.y)(x - b.x)
      new Line(b.y - a.y, a.x - b.x, a.y * b.x - a.x * b.y)
    }
  }
  case class Line(a: Double, b: Double, c: Double) {//ax + by + c == 0
    def angle: Angle = Angle(-b, a)
    def isParallel(that: Line): Boolean = math.abs(a * that.b - that.a * b) < efs
    def crossPoint(that: Line): Option[Point] = if (isParallel(that)) None else Some(Point((this.b * that.c - that.b * this.c) / (this.a * that.b - that.a * this.b), (that.a * this.c - this.a * that.c) / (this.a * that.b - that.a * this.b)))
  }
  object Angle{
    def apply(x: Double, y: Double): Angle = {
      new Angle(y / math.sqrt(x * x + y * y), x / math.sqrt(x * x + y * y))
    }
    def apply(point: Point): Angle = Angle(point.x, point.y)
  }
  class Angle private(val sin: Double, val cos: Double) {
    import Fractional.Implicits._
    def +(that: Angle): Angle = new Angle(sin * that.cos + cos * that.sin, cos * that.cos - sin * that.sin)
    def -(that: Angle): Angle = new Angle(sin * that.cos - cos * that.sin, cos * that.cos + sin * that.sin)
    def rotate90: Angle = new Angle(-cos, sin)

    override def toString: String = s"Angle($sin, $cos)"
  }
  case class Point(x: Double, y: Double) {
    def +(that: Point): Point = Point(x + that.x, y + that.y)
    def -(that: Point): Point = Point(x - that.x, y - that.y)
  }
  implicit class Scope[T](val value: T) extends AnyVal{
    @inline
    def also(@inline func: T ⇒ Unit): T = {
      func(value)
      value
    }
    @inline
    def let[A](func: T ⇒ A): A = func(value)
  }
}



Measured memory_bytes: 591920