#include #include #include #include #include using namespace std; struct Point { int x, y; }; int n; Point v[100]; vector > table1[4001]; vector > table2[4001]; double GetX(const Point& a, const Point& b, double y) { static const double epcilon = 0.000000000001; double t = (a.x - b.x) * (y - b.y) / (a.y - b.y) + b.x; if(ceil(t) - t < epcilon) t = ceil(t); if(t - floor(t) < epcilon) t = ceil(t); return t; } void Add(const Point& a, const Point& b) { double x1, x2; if(a.y < b.y) { for(int y = a.y; y < b.y; ++y) { x1 = GetX(a, b, y); x2 = GetX(a, b, y+1); if(a.x > b.x) swap(x1, x2); table1[y+2000].push_back(make_pair((int)floor(x1), 1)); table2[y+2000].push_back(make_pair((int)ceil(x2), 1)); } } else { for(int y = b.y; y < a.y; ++y) { x1 = GetX(a, b, y); x2 = GetX(a, b, y+1); if(a.x > b.x) swap(x1, x2); table1[y+2000].push_back(make_pair((int)ceil(x1), -1)); table2[y+2000].push_back(make_pair((int)floor(x2), -1)); } } } int CountT(vector >& t) { sort(t.begin(), t.end()); int cnt = 0; int state = 0; int prev; for(vector >::iterator p = t.begin(); p != t.end(); ++p) { if(state) cnt += p->first - prev; state += p->second; prev = p->first; } return cnt; } int Count() { int c1 = 0; int c2 = 0; for(int i = 0; i < 4001; ++i) { c1 += CountT(table1[i]); c2 += CountT(table2[i]); } return max(c1, c2); } int main() { while(cin >> n && n) { for(int i = 0; i < 4001; ++i) { table1[i].clear(); table2[i].clear(); } for(int i = 0; i < n; ++i) { cin >> v[i].x >> v[i].y; if(i) Add(v[i-1], v[i]); } Add(v[n-1], v[0]); cout << Count() << endl; } }