#include <bits/stdc++.h>
using namespace std;
const long double EPS = 0.00001;
const long double PI = 3.14159265358979323846;
inline void file_io(string in_file, string out_file, bool mark) {
  if (!mark) return;
  freopen(in_file.c_str(), "r", stdin);
}
struct group {
  group() {}
  group(int x, bool end, int id) : x(x), end(end), id(id) {}
  int x, id;
  bool end;
};
vector<group> g, gg;
bool cmp(const group& g1, const group& g2) {
  return g1.x < g2.x || (g1.x == g2.x && g1.end > g2.end);
}
bool may(int id) {
  for (int i = 0, j = 0; i < g.size(); ++i) {
    if (g[i].id != id) gg[j++] = g[i];
  }
  for (int i = 0; i < gg.size(); ++i) {
    if (gg[i].id == id) continue;
    if (i & 1) {
      if (!gg[i].end) return 0;
    } else {
      if (gg[i].end) return 0;
    }
  }
  return 1;
}
int main() {
  file_io("input.in", "cyclic.out", 0);
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n, l, r;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> l >> r;
    g.push_back((group(l, 0, i)));
    g.push_back((group(r, 1, i)));
  }
  gg.resize(g.size() - 2);
  sort((g).begin(), (g).end(), cmp);
  vector<int> ans;
  for (int i = 1; i <= n; ++i) {
    if (may(i)) ans.push_back((i));
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); ++i) cout << ans[i] << " ";
  return 0;
}
