#include <bits/stdc++.h>
using namespace std;
int main() {
  int c, n, k, l, r[100000];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l >> r[i];
  }
  cin >> k;
  c = 0;
  while (r[c] < k) {
    c++;
  }
  cout << n - c;
  return 0;
}
