#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  int n;
  cin >> n;
  pair<int, int> arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i].first >> arr[i].second;
  int k;
  cin >> k;
  int ans;
  for (int i = 0; i < n; i++) {
    if (k <= arr[i].second) {
      ans = i;
      break;
    } else
      continue;
  }
  cout << n - ans << endl;
  return 0;
}
