#include <bits/stdc++.h>
using namespace std;
struct point {
  int val, idx, type;
};
int n;
vector<int> possible;
vector<point> points;
bool comp(point a, point b) {
  if (a.val == b.val) {
    return a.type < b.type;
  }
  return a.val < b.val;
}
bool check(int x) {
  int curr = 0;
  for (int i = 0; i < points.size(); i++) {
    if (points[i].idx == x) {
      continue;
    }
    if (points[i].type == 1) {
      curr++;
    } else {
      curr--;
    }
    if (curr > 1) {
      return false;
    }
  }
  return true;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    points.push_back({a, i, 1});
    points.push_back({b, i, 0});
  }
  sort(points.begin(), points.end(), comp);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (check(i)) {
      ans++;
      possible.push_back(i + 1);
    }
  }
  cout << ans << endl;
  for (int i = 0; i < ans; i++) {
    cout << possible[i] << ' ';
  }
}
