#include <utility>
#include <cstdio>
#include <cmath>
#include <map>
typedef std::pair<unsigned int,unsigned int> count;
std::map<unsigned int,count> c;
int main()
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
int a,b;
scanf("%d%d",&a,&b);
c[a].first++;
if(a!=b)
{
c[b].first++;
c[b].second++;
}
}
unsigned int min=0xfffffffe;
unsigned int need=(n+1)/2;
for(std::map<unsigned int,count>::iterator i=c.begin();i!=c.end();i++)
if((i->second).first>=(n+1)/2)
min=std::min(min,std::max(0U,need-(i->second).first+(i->second).second));
if(min==0xfffffffe) puts("Impossible");
else printf("%u\n",min);
return 0;
}