#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int min_cardinality(int n) {
ll excluded[n];
memset(excluded,0,sizeof(excluded));
vector<ll> inside;
for (int i=0;i<n;i++) {
move_inside(i);
inside.push_back(i);
}
ll num = press_button();
while (num != inside.size()){
for (int nd:inside){
move_outside(nd);
ll yes = press_button();
if (yes != num){
excluded[nd] = 1;
move_inside(nd);
}
}
for (int nd:inside){
if (excluded[nd]) move_outside(nd);
}
inside.clear();
for (int i=0;i<n;i++){
if (excluded[i]) continue;
move_inside(i);
inside.push_back(i);
}
num = press_button();
}
return num;
}