#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<pair<long long, pair<long long, long long> > > v;
  for (long long i = 0; i < n; i++) {
    long long l, r;
    cin >> l >> r;
    v.push_back({l, {r, i + 1}});
  }
  vector<long long> ans;
  stable_sort(v.begin(), v.end());
  for (long long i = 0; i < n; i++) {
    long long maxi = 0;
    long long f = 0;
    for (long long j = 0; j < n; j++) {
      if (v[j].second.second != i + 1) {
        if (v[j].first >= maxi) {
          maxi = max(v[j].second.first, maxi);
        } else {
          f = 1;
          break;
        }
      }
    }
    if (!f) ans.push_back(i + 1);
  }
  cout << ans.size() << endl;
  for (auto i : ans) cout << i << " ";
  return 0;
}
