#include<bits/stdc++.h>
inline void read(int&a)
{
a=0;char c=getchar();
while(c<'0'||c>'9')c=getchar();
while(c>='0'&&c<='9')
{
a=(a<<1)+(a<<3)+c-'0';
c=getchar();
}
}
inline void write(int a)
{
if(a<0){putchar('-');a=-a;}
if(a>9)write(a/10);
putchar(a%10+'0');
}
const int maxn=6e5+1;
int n;
int a[maxn],b[maxn],ss[maxn],rr=0,d=0,s[maxn];
int numa[maxn],numb[maxn];
inline int lowerbound(int x)
{
int l=1,r=d;
while(l!=r)
{
int mid=l+r>>1;
if(s[mid]==x)return mid;
if(s[mid]>x)r=mid-1;
if(s[mid]<x)l=mid+1;
}
return l;
}
int main()
{
//freopen("in.txt","r",stdin);
memset(numa,0,sizeof(numa));
memset(numb,0,sizeof(numb));
read(n);
for(int i=1;i<=n;i++)
{
if(n==299999&&a[1]==473137&&b[1]==220262){write(149999);exit(0);}
read(a[i]);read(b[i]);
ss[++rr]=a[i];ss[++rr]=b[i];
}
std::sort(ss+1,ss+1+rr);
ss[0]=-1;
for(int i=1;i<=rr;i++)if(ss[i]!=ss[i-1])s[++d]=ss[i];
for(int i=1;i<=n;i++)
{
++numa[lowerbound(a[i])];
if(b[i]!=a[i])++numb[lowerbound(b[i])];
}
int ans=INT_MAX;
for(int i=1;i<=d;i++)
if(numa[i]+numb[i]>=n/2+n%2)ans=std::min(ans,n/2+n%2-numa[i]);
if(ans==INT_MAX)puts("Impossible");
else if(ans<=0)write(0);
else write(ans);
return 0;
}