#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
const int N=300005;
map<int,int> M0,M1;
int A[2*N];
int n,m,a[N],b[N],ans=N;
void init()
{
scanf("%d", &n);
for (int i=1; i<=n; i++)
{
scanf("%d %d",&a[i], &b[i]);
if (a[i]==b[i]) M0[a[i]]++;//记录a的次数
else M0[a[i]]++, M1[b[i]]++;
A[++m]=a[i];//将所有出现的数都放在A[]中
A[++m]=b[i];
}
sort(A+1,A+m+1);
}
void work()
{
for (int i=1; i<=m; i++)//枚举在最终要翻的牌面数字
{
int x=M0[A[i]],y=M1[A[i]];
if (x+y>=(n+1)/2)
ans=min(ans,max((n+1)/2-x,0));
}
if (ans==N)printf("Impossible\n");
else printf("%d\n",ans);
return;
}
int main()
{
init();
work();
return 0;
}