#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > f, s;
vector<long long> ans;
bool overlap() {
  for (int i = 1; i < f.size(); i++) {
    if (f[i].first < f[i - 1].second) return true;
  }
  return false;
}
int main() {
  long long t, a, b, i, j, n;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a >> b;
    f.push_back(make_pair(a, b));
  }
  s = f;
  sort(f.begin(), f.end());
  map<long long, long long> vis;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (f[j] == s[i] and vis[j] == 0) {
        vis[j] = 1;
        pair<long long, long long> r;
        r = f[j];
        f.erase(f.begin() + j);
        if (!(overlap())) ans.push_back(i + 1);
        f.insert(f.begin() + j, r);
      }
    }
  }
  cout << ans.size() << endl;
  if (ans.size() != 0) {
    for (auto p : ans) cout << p << " ";
    cout << endl;
  }
}
