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