#include<stdio.h> int main() { int n,i,l,r,l1=0,r1=0; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%d %d",&l,&r); if(l==1)l1++; if(r==1)r1++; } if(n-l1<l1)l1=n-l1; if(n-r1<r1)l1+=n-r1; else l1+=r1; printf("%d",l1); return 0; }
http://codeforces.com/contest/248/problem/A