#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,ans=N;
int main()
{
scanf("%d", &n);
for (int i=1; i<=n; i++)
{
int a,b;
scanf("%d %d",&a, &b);
if (a==b) M0[a]++;//¼Ç¼aµÄ´ÎÊý
else M0[a]++, M1[b]++;
A[++m]=a;//½«ËùÓгöÏÖµÄÊý¶¼·ÅÔÚA[]ÖÐ
A[++m]=b;
}
sort(A+1,A+m+1);
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 0;
}