### constant

INF = 1 << 30

### subroutines

# x=vx*t+px0, y=vy*t+py0
# t = (x-px0)/vx = (y-py0)/vy
# x = (y-py0)/vy*vx+px0

def cross_x(px0, py0, px1, py1, y)
  vx = px1 - px0
  vy = py1 - py0
  (y - py0).to_f * vx / vy + px0
end

### main

loop do
  n = gets.to_i
  break if n == 0

  pts = []
  min_y = INF
  max_y = -INF
  
  n.times do
    xi, yi = gets.split.map(&:to_i)
    min_y = yi if min_y > yi
    max_y = yi if max_y < yi
    pts << [xi, yi]
  end
  pts << pts.first
  #p pts
  #p [min_y, max_y]

  count = 0

  for y0 in (min_y...max_y)
    y1 = y0 + 1
    xs0 = []
    xs1 = []

    pts.each_cons(2) do |pt0, pt1|
      if pt0[1] <= y0 && pt1[1] >= y1 ||
         pt1[1] <= y0 && pt0[1] >= y1
        xs0 << cross_x(*pt0, *pt1, y0)
        xs1 << cross_x(*pt0, *pt1, y1)
      end
    end
    xs0.sort!
    xs1.sort!

    ranges = []
    while ! xs0.empty?
      xis = [xs0.shift, xs0.shift, xs1.shift, xs1.shift]
      xmin = xis.min
      xmax = xis.max
      ranges << [xmin.floor, xmax.ceil]
    end
    #p ranges

    prv = nil
    for range in ranges
      if prv.nil?
        prv = range
      elsif range[0] <= prv[1] && prv[0] <= range[1]
        prv[0] = range[0] if prv[0] > range[0]
        prv[1] = range[1] if prv[1] < range[1]
      else        
        count += prv[1] - prv[0]
        prv = range
      end
    end
    count += prv[1] - prv[0] if prv
  end

  puts count
end