#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

typedef complex<double> P;
namespace std{
	bool operator<(const P& a, const P& b){
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
inline double cross(const P& a, const P& b){ return imag(conj(a)*b); }
inline double dot(const P& a, const P& b){ return real(conj(a)*b); }
struct L : public vector<P>{
	L(const P &a, const P &b) {
		push_back(a); push_back(b);
	}
};
typedef vector<P> G;

inline int ccw(P a, P b, P c) {
	b -= a; c -= a;
	if(cross(b, c) > 0)   return +1;		// counter clockwise
	if(cross(b, c) < 0)   return -1;		// clockwise
	if(dot(b, c) < 0)     return +2;		// c--a--b on line
	if(norm(b) < norm(c)) return -2;		// a--b--c on line
	return 0;
}
#define curr(g, i) g[i]
#define next(g, i) g[(i+1)%g.size()]
enum { OUT, ON, IN };
int contains(const G& g, const P& p) {
  bool in = false;
  for (int i = 0; i < g.size(); ++i) {
    P a = curr(g,i) - p, b = next(g,i) - p;
    if (imag(a) > imag(b)) swap(a, b);
    if (imag(a) <= 0 && 0 < imag(b))
      if (cross(a, b) < 0) in = !in;
    if (cross(a, b) == 0 && dot(a, b) <= 0) return ON;
  }
  return in ? IN : OUT;
}
const int GETA = 2048;
int n, mxx, mnx, mxy, mny;
char flag[4096][4096];

inline void rec(int y, int x, int p){
	queue<pi> q;
	q.push(mp(y, x));
	flag[y][x] = p;
	while(!q.empty()){
		y = q.front().first; x = q.front().second;
		q.pop();
		
		rep(d, 4){
			const int dy[] = {-1, 0, 1, 0}, dx[] = {0, -1, 0, 1};
			int ny = y + dy[d], nx = x + dx[d];
			if(ny < mnx || ny >= mxx || nx < mny || nx >= mxy || flag[ny][nx]) continue;
			flag[ny][nx] = p;
			q.push(mp(ny, nx));
		}
	}
}
inline void draw(const P &a, const P &b, int rot){
	int x = a.real(), y = a.imag(), X = b.real(), Y = b.imag();
	int dx = X - x, dy = Y - y, mod = 0;
	vector<pi> v;
	for(; x < X; x++){
		v.pb(mp(x, y));
		mod += dy;
		while(mod > dx){
			mod -= dx;
			v.pb(mp(x, ++y));
		}
		if(mod == dx) mod -= dx, y++;
	}
	rep(i, v.size()){
		int x = v[i].first, y = v[i].second;
		rep(it, rot){
			swap(x, y);
			x *= -1;
		}
		const int dx[] = {0, -1, -1, 0}, dy[] = {0, 0, -1, -1};
		assert(x + dx[rot] + GETA < 4096 && x + dx[rot] + GETA >= 0);
		assert(y + dy[rot] + GETA < 4096 && y + dy[rot] + GETA >= 0);
		flag[x + dx[rot] + GETA][y + dy[rot] + GETA] = 1;
	}
}
inline void draw(P a, P b){
	rep(i, 4){
		if(a.real() < b.real() && a.imag() <= b.imag()){
			draw(a, b, i);
			return;
		}
		a *= P(0, -1);
		b *= P(0, -1);
	}
}
double area2(const G& g) {
  double A = 0;
  for (int i = 0; i < g.size(); ++i) 
    A += cross(curr(g, i), next(g, i));
  return A;
}

int main(){
	while(cin >> n, n){
		G g(n);
		int ans = 0;
		mxx = mxy = -inf; mnx = mny = inf;
		rep(i, n){
			cin >> g[i].real() >> g[i].imag();
			mxx = max((int)g[i].real(), mxx); mnx = min((int)g[i].real(), mnx);
			mxy = max((int)g[i].imag(), mxy); mny = min((int)g[i].imag(), mny);
		}
		mxx += 20 + GETA; mnx += -20 + GETA;
		mxy += 20 + GETA; mny += -20 + GETA;
		if(area2(g) < 0) reverse(all(g));
		
		rep(i, n) draw(g[i], g[(i + 1) % n]);
		for(int i = mnx; i < mxx; i++) for(int j = mny; j < mxy; j++) if(!flag[i][j]){
			rec(i, j, contains(g, P(i - GETA + 0.5, j - GETA + 0.5)) ? 1 : -1);
		}
		for(int i = mnx; i < mxx; i++) for(int j = mny; j < mxy; j++) if(flag[i][j] > 0) ans++;
		cout << ans << endl;
		
		for(int i = mnx; i < mxx; i++) for(int j = mny; j < mxy; j++) flag[i][j] = 0;
	}
	return 0;
}

Measured memory_bytes: 17652