#include <bits/stdc++.h>
using namespace std;
template <class T>
int len(const T &c) {
  return (int)c.size();
}
template <class T>
void cmin(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
void cmax(T &a, T b) {
  if (b > a) a = b;
}
vector<pair<int, int> > v;
int main() {
  int n, t1, t2;
  cin >> n;
  for (int i(0), _n(n); i < _n; ++i) {
    cin >> t1 >> t2;
    if (t1 > t2) swap(t1, t2);
    v.push_back(make_pair(t1, t2));
  }
  vector<int> ans;
  vector<pair<int, int> > tem;
  bool b;
  for (int i(0), _n(n); i < _n; ++i) {
    b = 1;
    tem.clear();
    for (int j(0), _n(n); j < _n; ++j)
      if (j != i) tem.push_back(v[j]);
    sort(tem.begin(), tem.end());
    for (int j(0), _n(n - 2); j < _n; ++j) {
      if (tem[j].second > tem[j + 1].first) {
        b = 0;
        break;
      }
    }
    if (b) ans.push_back(i + 1);
  }
  cout << len(ans) << endl;
  for (int i(0), _n(len(ans)); i < _n; ++i) cout << ans[i] << " ";
}
