program lauzte;
  { 50 u‘davinys }
  const M = 100; { maksimalus lau‘t‚s tažk— skai‡ius }
  type taskas = record
                  x, y: 0..maxint
                end;
       koordinates = array [1..M] of taskas;
       atkarpos = array [1..M] of record  { atkarpos prad‘ia ir pabaiga }
                                    pr, pb: taskas
                                  end;  { pr < pb }

  procedure sudaryti_atkarpas (k: koordinates; sk: integer;
                               var atk: atkarpos;  { sudarytosios atkarpos }
                               var s: integer);    { j— skai‡ius }
  { sudaromos visos vertikalios atkarpos }
    var i: integer;
  begin
    s := 0;
    for i := 1 to sk do
      if k[i].x = k[i+1].x     { jei atkarpa vertikali }
         then begin
                s := s + 1;
                if k[i].y < k[i+1].y  { turi galioti pr < pab }
                   then begin
                          atk[s].pr := k[i];
                          atk[s].pb := k[i+1]
                        end
                   else begin
                          atk[s].pr := k[i+1];
                          atk[s].pb := k[i]
                        end
              end
  end; { sudaryti_atkarpas }

  procedure rikiuoti (var atk: atkarpos;
                      s: integer);
  { burbuliuko metodu surikiuoja atkarpas did‚jimo tvarka }
  { pagal koordinatŠ x }
   var i: integer;
       t: taskas;
  begin
   i := 1;
   while i < s do
     if atk[i].pr.x <= atk[i + 1].pr.x
        then i := i + 1
        else begin
               t := atk[i].pr;
               atk[i].pr := atk[i + 1].pr;
               atk[i + 1].pr := t;
               t := atk[i].pb;
               atk[i].pb := atk[i + 1].pb;
               atk[i + 1].pb := t;
               if i > 1
                  then i := i - 1
                  else i := i + 1
             end
  end;

  function plotas (k: koordinates; sk: integer): integer;
  { randa lau‘t‚s plot… }
    var fig,             { fig–ros plotas }
        i, j, pradzia,
        miny, maxy,      { pirmojo ir paskutiniojo sluoksni— numeriai }
        s: integer;      { vertikali— atkarp— skai‡ius }
        atk: atkarpos;   { vertikalios atkarpos }
        prikl: boolean;  { ar nagrin‚jamas langelis priklauso fig–rai }
  begin
    sudaryti_atkarpas (k, sk, atk, s);
    rikiuoti (atk, s);
    { surasime sluoksni— skai‡i— }
    miny := maxint; maxy := 0;
    for i := 1 to sk do
      begin
        if miny > k[i].y
           then miny := k[i].y;
        if maxy < k[i].y
           then maxy := k[i].y;
      end;
     fig := 0;
     { tirsime kiekvien… sluoksn }
     for i := miny to maxy do
       begin
         prikl := false; { dar neradome langelio, priklausan‡io fig–rai }
         for j := 1 to s do
           if (atk[j].pr.y < i) and (i <= atk[j].pb.y)
              then begin
                     if prikl
                        then fig := fig + (atk[j].pr.x - pradzia)
                        else pradzia := atk[j].pr.x;
                      prikl := not prikl
                   end;
       end;
     plotas := fig
  end; { plotas }

  var f: text;
      sk: integer;
      k: koordinates;
begin
  assign (f, 'LAUZTE.DAT');
  reset (f);
  sk := 1;
  readln (f, k[sk].x, k[sk].y);
  repeat
    sk := sk + 1;
    readln (f, k[sk].x, k[sk].y);
  until (k[sk].x = k[1].x) and (k[sk].y = k[1].y);
  writeln (plotas (k, sk))
end.