#include <bits/stdc++.h>
using namespace std;
#define file(NAME) if (fopen(NAME".inp", "r")) freopen(NAME".inp", "r", stdin), freopen(NAME".out", "w", stdout)
#define FOR(i, a, b) for (int i = (int) a; i <= (int) b; ++i)
#define FOD(i, a, b) for (int i = (int) a; i >= (int) b; --i)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
const int maxn = 105 + 5;
const int N = 505;
const int MOD = 1e9 + 7;
int n;
pii a[maxn];
int dp[maxn], trace[maxn];
signed main() {
cin.tie(0) -> sync_with_stdio(0);
file("x");
cin >> n;
FOR(i, 1, n) {
cin >> a[i].fi >> a[i].se;
}
sort(a + 1, a + n + 1);
dp[1] = 1;
FOR(i, 2, n) FOD(j, i - 1, 1) {
if (a[i].se >= a[j].se && dp[i] < dp[j] + 1) {
dp[i] = dp[j] + 1;
trace[i] = j;
}
}
int id = 0, ans = 0;
FOR(i, 1, n) {
if (ans < dp[i]) {
ans = dp[i];
id = i;
}
}
cout << ans << '\n';
vector<int> res;
while (id) res.pb(id), id = trace[id];
reverse(all(res));
for (int x : res) cout << x << ' ';
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKI2RlZmluZSBmaWxlKE5BTUUpIGlmIChmb3BlbihOQU1FIi5pbnAiLCAiciIpKSAgZnJlb3BlbihOQU1FIi5pbnAiLCAiciIsIHN0ZGluKSwgZnJlb3BlbihOQU1FIi5vdXQiLCAidyIsIHN0ZG91dCkKI2RlZmluZSBGT1IoaSwgYSwgYikgZm9yIChpbnQgaSA9IChpbnQpIGE7IGkgPD0gKGludCkgYjsgKytpKQojZGVmaW5lIEZPRChpLCBhLCBiKSBmb3IgKGludCBpID0gKGludCkgYTsgaSA+PSAoaW50KSBiOyAtLWkpCgojZGVmaW5lIGFsbChzKSAocykuYmVnaW4oKSwgKHMpLmVuZCgpCiNkZWZpbmUgcGIgcHVzaF9iYWNrCiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgZmkgZmlyc3QKI2RlZmluZSBzZSBzZWNvbmQKI2RlZmluZSBwaWkgcGFpcjxpbnQsIGludD4KCmNvbnN0IGludCBtYXhuID0gMTA1ICsgNTsKY29uc3QgaW50IE4gPSA1MDU7CmNvbnN0IGludCBNT0QgPSAxZTkgKyA3OwoKaW50IG47CnBpaSBhW21heG5dOwppbnQgZHBbbWF4bl0sIHRyYWNlW21heG5dOwoKCgpzaWduZWQgbWFpbigpIHsKICAgIGNpbi50aWUoMCkgLT4gc3luY193aXRoX3N0ZGlvKDApOwogICAgZmlsZSgieCIpOwogICAgCiAgICBjaW4gPj4gbjsKCiAgICBGT1IoaSwgMSwgbikgewogICAgICAgIGNpbiA+PiBhW2ldLmZpID4+IGFbaV0uc2U7CiAgICB9CgogICAgc29ydChhICsgMSwgYSArIG4gKyAxKTsKCgogICAgZHBbMV0gPSAxOwogICAgRk9SKGksIDIsIG4pIEZPRChqLCBpIC0gMSwgMSkgewogICAgICAgIGlmIChhW2ldLnNlID49IGFbal0uc2UgJiYgZHBbaV0gPCBkcFtqXSArIDEpIHsKICAgICAgICAgICAgZHBbaV0gPSBkcFtqXSArIDE7CiAgICAgICAgICAgIHRyYWNlW2ldID0gajsKICAgICAgICB9CiAgICB9CiAgICAKCiAgICBpbnQgaWQgPSAwLCBhbnMgPSAwOwogICAgRk9SKGksIDEsIG4pIHsKICAgICAgICBpZiAoYW5zIDwgZHBbaV0pIHsKICAgICAgICAgICAgYW5zID0gZHBbaV07CiAgICAgICAgICAgIGlkID0gaTsKICAgICAgICB9CiAgICB9IAogICAgCiAgICBjb3V0IDw8IGFucyA8PCAnXG4nOwoKICAgIHZlY3RvcjxpbnQ+IHJlczsKICAgIHdoaWxlIChpZCkgcmVzLnBiKGlkKSwgaWQgPSB0cmFjZVtpZF07CgogICAgcmV2ZXJzZShhbGwocmVzKSk7CgogICAgZm9yIChpbnQgeCA6IHJlcykgY291dCA8PCB4IDw8ICcgJzsKICAgIHJldHVybiAwOwp9