class Point
  attr_reader :x, :y
  def initialize(position)
    @x = position[0]
    @y = position[1]
  end
end

class Line
  def initialize(point_one, point_two)
    @points = [point_one, point_two].sort{|one, two| one.x <=> two.x}
  end

  def y_of_intersection(x)
    x1 = @points[0].x
    x2 = @points[1].x
    y1 = @points[0].y
    y2 = @points[1].y
    return nil if x < x1 || x > x2
    return y1.to_f if x == x1
    return y2.to_f if x == x2
    additional_y = (y2 - y1).abs.to_f * (x - x1) / (x2 - x1)
    y1 > y2 ? y1 - additional_y : y1 + additional_y
  end

  def y_cut(low_x, high_x)
    y1 = y_of_intersection(low_x)
    y2 = y_of_intersection(high_x)
    return nil unless y1 && y2
    [y1, y2]
  end
end
while true
  point_number = gets.chomp.to_i
  break if point_number == 0
  points = []
  point_number.times do
    points.push(Point.new(gets.chomp.split(' ').map(&:to_i)))
  end
  points.push(points[0])
  lines = []
  points.each_cons(2) { |point_one, point_two|
    lines.push(Line.new(point_one, point_two))
  }
  max_x = points.max{|point_one, point_two| point_one.x <=> point_two.x }.x
  min_x = points.min{|point_one, point_two| point_one.x <=> point_two.x }.x
  area = 0
  (min_x..max_x).each_cons(2) do |xs|
    square_cuts = []
    crosses = lines.map { |line| line.y_cut(xs[0], xs[1])}
    sorted_crosses = crosses.compact.uniq.sort
    sorted_crosses.each_slice(2) do |two_lines|
      square_cuts.push([two_lines[0].min.floor, two_lines[1].max.ceil])
    end
    square_cuts.each.with_index do |cut, i|
      if i == 0
        area += (cut[1] - cut [0])
        next
      end
      former_end = square_cuts[i - 1][1]
      next if former_end >= cut[1]
      area += (cut[1] - [cut[0], former_end].max)
    end
  end
  puts area
end

