#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int M[n][2];
  for (int i = 0; i < n; i++) {
    cin >> M[i][1] >> M[i][2];
  }
  int k = 0;
  vector<int> v1, v2;
  for (int i = 0; i < n; i++) {
    double inf = M[i][1] + 0.5, sup = M[i][2] - 0.5;
    for (int j = 0; j < n; j++) {
      if (((M[j][1] - inf) * (M[j][2] - inf) < 0 or
           (M[j][1] - sup) * (M[j][2] - sup) < 0) and
          i != j) {
        v1.push_back(i);
        v2.push_back(j);
        k++;
      }
    }
  }
  if (k == 0) {
    cout << n << endl;
    for (int i = 0; i < n; i++) {
      cout << i + 1 << " ";
    }
  } else {
    int o1 = 1, o2 = 1;
    int my = v1[0], mn = v2[0];
    if (v1[0] < v2[0]) {
      my = v2[0];
      mn = v1[0];
    }
    for (int i = 0; i < k; i++) {
      if ((v1[i] - my) * (v2[i] - my) != 0) {
        o1 = 0;
      }
      if ((v1[i] - mn) * (v2[i] - mn) != 0) {
        o2 = 0;
      }
    }
    cout << o1 + o2 << endl;
    if (o2) {
      cout << mn + 1 << " ";
    }
    if (o1) {
      cout << my + 1 << " ";
    }
  }
}
