#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll INFll = 1ll * 1000000007 * 1000000007;
const long double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
ll gcd(ll a, ll b) { return (b == 0) ? a : gcd(b, a % b); }
int min(int a, int b) { return ((a > b) ? b : a); }
ll nax = 3 * 1e5 + 5;
ll n;
int a, b;
map<int, int> incr, decr;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (ll i = 1; i <= n; i++) {
    cin >> a >> b;
    if (a > b)
      decr[b] = i;
    else
      incr[-b] = i;
  }
  cout << max(incr.size(), decr.size()) << '\n';
  if (incr.size() > decr.size()) {
    for (auto i : incr) cout << i.second << ' ';
    cout << '\n';
    return 0;
  }
  for (auto i : decr) cout << i.second << ' ';
  cout << '\n';
  return 0;
}
