#include <iostream>
#include <cmath>
using namespace std;

int main()
{  int n;
  cin >>n;
   int suma1=0,suma2=0,t=0,a1,a2,m=0,o=0;
   cin >>a1>>a2;
   int ap1=a1;
   int ap2=a2;
   suma1+=a1;
   suma2+=a2;
   for(int i=1;i<n;i++)
   { cin >>a1>>a2;
    if(a1==ap1)
        {t+=1;m++;}
    if(a2==ap2)
        {t+=1;o++;}
    suma1+=a1;
    suma2+=a2;
   ap1=a1;
   ap2=a2;
   }
   int x=n*(n+1)/2;
    {if(suma1==x)
        t+=0;
     else if(x>suma1)
        t+=abs(abs(x-suma1)-m);
          else
            t+=abs(abs(suma1-x)-m);}
    {if(suma2==x)
        t+=0;
    else if(x>suma2)
        t+=abs(abs(x-suma2)-o);
        else
        t+=abs(abs(suma2-x)-o);}
    cout <<t<<endl;
    return 0;
}