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