#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int MOD = 998244353;
const double PI = 2 * acos(0.0);
struct Node {
  int first, second, id;
  Node() {}
};
Node a[N];
vector<int> ans;
vector<Node> tmp;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &a[i].first, &a[i].second);
    a[i].id = i + 1;
  }
  sort(a, a + n, [](Node x, Node y) {
    return x.first == y.first ? x.second < y.second : x.first < y.first;
  });
  for (int i = 0; i < n; i++) {
    bool ok = 1;
    tmp.clear();
    for (int j = 0; j < n; j++) {
      if (i != j) {
        tmp.push_back(a[j]);
      }
    }
    for (int j = 1; j < tmp.size(); j++) {
      if (tmp[j].first >= tmp[j - 1].second) {
        continue;
      } else {
        ok = 0;
        break;
      }
    }
    if (ok) {
      ans.push_back(a[i].id);
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << '\n';
  for (auto i : ans) {
    cout << i << " ";
  }
  puts("");
  return 0;
}
