#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<pair<int, int> > vec;
  cin >> n;
  for (int i = 0; i < n; i++) {
    pair<int, int> p;
    cin >> p.first;
    cin >> p.second;
    vec.push_back(p);
  }
  int t;
  cin >> t;
  for (int i = 0; i < n; i++) {
    if (t <= vec[i].second) {
      cout << n - i << endl;
      break;
    }
  }
  return 0;
}
