#include <utility>
#include <cstdio>
#include <cmath>
#include <map>
typedef std::pair<long long,long long> count;
std::map<long long,count> c;
int main()
{
freopen("card.in","r",stdin);
// freopen("card.out","w",stdout);
int n;
scanf("%d",&n);
bool check=false;
long long need=(n+1)>>1;
for(int i=0;i<n;i++)
{
long long a,b;
scanf("%lld%lld",&a,&b);
c[a].first++;
if(a!=b)
{
c[b].first++;
c[b].second++;
}
if(c[a].first>=need) check|=true;
if(c[b].first>=need) check|=true;
}
if(!check) puts("Impossible");
else
{
long long min=n>>1;
for(std::map<long long,count>::iterator i=c.begin();i!=c.end();i++)
if((i->second).first>=need)
min=std::min(min,std::max(0LL,need-(i->second).first+(i->second).second));
printf("%lld\n",min);
}
return 0;
}