#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<double, double> pd;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;

typedef double D;
typedef complex<D> P;
typedef pair<P, P> L;
typedef vector<P> VP;
const D EPS = 1e-9;
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

// 内積　dot(a,b) = |a||b|cosθ
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
  return (conj(a)*b).Y;
}

bool is_orthogonal(P a1, P a2, P b1, P b2) {
  return EQ( dot(a1-a2, b1-b2), 0.0 );
}

// 点の進行方向
int ccw(P a, P b, P c) {
  b -= a;  c -= a;
  if (cross(b,c) >  EPS) return +1;  // counter clockwise
  if (cross(b,c) < -EPS) return -1;  // clockwise
  if (dot(b,c)   < -EPS) return +2;  // c--a--b on line
  if (norm(b) < norm(c)) return -2;  // a--b--c on line or a==b
  return 0;                          // a--c--b on line or a==c or b==c
}

bool isecSS(P a1, P a2, P b1, P b2) {
  return ccw(a1, a2, b1)*ccw(a1, a2, b2) <= 0 &&
         ccw(b1, b2, a1)*ccw(b1, b2, a2) <= 0;
}

P crosspointLL(P a1, P a2, P b1, P b2) {
  D d1 = cross(b2-b1, b1-a1);
  D d2 = cross(b2-b1, a2-a1);
  if (EQ(d1, 0) && EQ(d2, 0)) return a1;  // same line
  if (EQ(d2, 0)) throw "kouten ga nai";   // 交点がない
  return a1 + d1/d2 * (a2-a1);
}

int board[4001][4001];
vector<pd> hoge[4000];

int n;
P p[100];

void solve() {
    memset(board, 0, sizeof(board));
    rep(i,4000) hoge[i].clear();
    rep(i,n) {
        double x, y; cin >> x >> y;
        x += 2000; y += 2000;
        p[i] = P(x,y);
    }
    rep(i,n) {
        int j = (i+1)%n;
        if (p[i].Y == p[j].Y) continue;
        bool swapped = false;
        if (p[i].Y > p[j].Y) {
            swapped = true;
            swap(i,j);
        }
        for (int k = p[i].Y; k < p[j].Y; k++) {
            P cp1 = crosspointLL(P(0,k), P(1,k), p[i], p[j]);
            P cp2 = crosspointLL(P(0,k+1), P(1,k+1), p[i], p[j]);
            hoge[k].push_back(pd(cp1.X, cp2.X));
            //cerr << k << " " << cp1.X << " " << cp2.X << endl;
        }
        if (swapped) {
            swap(i,j);
        }
    }
    int ans = 0;
    rep(i,4000) {
        sort(hoge[i].begin(), hoge[i].end());
        int lef = 0;
        int rig = 0;
        for (int j = 0; j < hoge[i].size(); j++) {
            if (j%2 == 0) {
                double t = min(hoge[i][j].first, hoge[i][j].second);
                lef = max(rig, (int)(t+EPS));
            } else {
                double t = max(hoge[i][j].first, hoge[i][j].second);
                rig = (int)(t+1.0-EPS);
                ans += rig - lef;
            }
        }
    }
    cout << ans << endl;
}

int main() {
#ifndef LOCAL
    ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
    cout.precision(20);
    cerr << fixed;
    cerr.precision(6);
    while (cin >> n) {
        if (n == 0) break;
        solve();
    }
    return 0;
}



Measured memory_bytes: 73764