#include <bits/stdc++.h>
using namespace std;
const long long int MAXN = 1e2 + 10;
const long long int MINN = 1e5 + 10;
const long long int inf = 1e18 + 7;
vector<pair<pair<int, int>, int>> v;
vector<int> ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin.exceptions(cin.failbit);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  int n;
  cin >> n;
  for (int i = 0; i < (n); ++i) {
    int a, b;
    cin >> a >> b;
    v.push_back({{a, b}, i + 1});
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < (v.size()); ++i) {
    vector<pair<pair<int, int>, int>> tmp;
    for (int j = 0; j < (v.size()); ++j) {
      if (i == j) continue;
      tmp.push_back(v[j]);
    }
    bool f = true;
    for (int j = 0; j < (tmp.size() - 1); ++j)
      if (tmp[j].first.second > tmp[j + 1].first.first) f &= false;
    if (f) ans.push_back(v[i].second);
  }
  cout << ans.size() << endl;
  sort(ans.begin(), ans.end());
  for (int i = 0; i < (ans.size()); ++i) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
