#include<bits/stdc++.h>
#define fre(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout);
#define IsDigit(c) ('0'<=(c) && (c)<='9')
#define MAX 5 + 300000
#define INF 1<<30
using namespace std;
inline int read()
{
int x=0; bool f=true;
char c=getchar();
for (;!IsDigit(c);c=getchar()) if (c=='-') f=false;
for (;IsDigit(c);c=getchar()) x=(x<<3)+(x<<1)+(c^'0');
return f ? x : -x;
}
inline void write(int x)
{
if (x<0)
{
putchar('-');
x=-x;
}
if (x>9) write(x/10);
putchar(x%10+'0');
}
int n,Half,cnt,Ans=INF;
int a[MAX],b[MAX],Num[MAX];
map<int,int>UpSm,DwDf;
signed main()
{
// fre(card);
n=read(); Half=(n+1)>>1;
for (register int i=1;i<=n;i++)
{
a[i]=read(); b[i]=read();
if (a[i]==b[i]) UpSm[a[i]]++;
else UpSm[a[i]]++,DwDf[b[i]]++;
Num[++cnt]=a[i]; Num[++cnt]=b[i];
}
sort(Num+1,Num+cnt+1);
for (register int x,y,i=1;i<=cnt;i++)
{
x=UpSm[Num[i]],y=DwDf[Num[i]];
if (x+y>=Half) Ans=min(Ans,max(Half-x,0));
if (Ans==0){putchar('0');return 0;}
}
if (Ans==INF) puts("Impossible");
else write(Ans);
return 0;
}