#include<bits/stdc++.h>
using namespace std;
int a[400005],b[400005],c[800010],fa[400005],fb[400005];
int ans=1e9;
int main()
{
// freopen("card.in","r",stdin);
// freopen("card.out","w",stdout);
int n;
cin>>n;
for (int i=1;i<=n;i++)
{
cin>>a[i]>>b[i];
c[2*i-1]=a[i];
c[2*i]=b[i];
}
sort(c+1,c+2*n+1);
int len=unique(c+1,c+2*n+1)-c-1;
for(int i=1;i<=n;i++)
{
a[i]=lower_bound(c+1,c+1+len,a[i])-c;
b[i]=lower_bound(c+1,c+1+len,b[i])-c;
}
for (int i=1;i<=n;i++)
{
fa[a[i]]++;
if (a[i]!=b[i]) fb[b[i]]++;
}
int m=(n+1)/2;
for (int i=1;i<=len;i++)
{
if (fa[i]+fb[i]>=m)
{
ans=min(m-fa[i],ans);
}
}
if (ans!=1e9) cout<<max(ans,0);
else puts("Impossible");
}