#include <bits/stdc++.h>
using namespace std;
bool intersect(pair<int, int> a, pair<int, int> b) {
  return (a.first > b.first && a.first < b.second) ||
         (b.first > a.first && b.first < a.second);
}
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > groups(n);
  for (int i = 0; i < n; i++) cin >> groups[i].first >> groups[i].second;
  vector<int> num_intersects(n, 0);
  int total_num_intersects = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      if (intersect(groups[i], groups[j])) {
        num_intersects[i]++;
        num_intersects[j]++;
        total_num_intersects++;
      }
    }
  vector<int> result;
  for (int i = 0; i < n; i++) {
    if (total_num_intersects == num_intersects[i]) result.push_back(i + 1);
  }
  cout << result.size() << endl;
  for (int i = 0; i < result.size(); i++) cout << result[i] << " ";
  return 0;
}
