#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  int m;
  while(cin>>m,m){
    using P = pair<int, int>;
    using E = pair<P, P>;
    vector<P> ps(m);
    for(int i=0;i<m;i++){
      cin>>ps[i].first>>ps[i].second;
      ps[i].first+=2020;
      ps[i].second+=2020;
    }
    
    vector<E> es;
    for(int i=0;i<m;i++){
      int j=(i+1)%m;
      es.emplace_back(ps[i],ps[j]);
    }
    
    for(int i=0;i<m;i++){
      if(es[i].first.second>es[i].second.second)
        swap(es[i].first,es[i].second);      
    }
    
    int ans=0;
    auto calc=
      [&](int y,P a,P b){        
        int dy=b.second-a.second;
        if(a.first<=b.first){
          int dx=b.first-a.first;
          P res(a.first+dx*(y-a.second)/dy,
                a.first+dx*(y-a.second)/dy);
          if(dx*(y-a.second)%dy) res.second++;
          return res;
        }else{
          int dx=a.first-b.first;
          P res(a.first-dx*(y-a.second)/dy,
                a.first-dx*(y-a.second)/dy);
          if(dx*(y-a.second)%dy) res.first--;
          return res;
        }
      };
    
    for(int y=0;y<5000;y++){
      vector<P> ss;
      for(int i=0;i<m;i++){
        auto a=es[i].first;
        auto b=es[i].second;
        assert(a.second<=b.second);
        
        if(a.second>y) continue;
        if(b.second<y+1) continue;

        auto c=calc(y,a,b);
        auto d=calc(y+1,a,b);
        ss.emplace_back(min(c.first,d.first),max(c.second,d.second));
      }
      
      sort(ss.begin(),ss.end());
      assert(ss.size()%2==0);
      int prv=0;
      for(int i=0;i<(int)ss.size();i+=2){
        ans+=ss[i+1].second-max(ss[i].first,prv);
        prv=ss[i+1].second;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

