#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  pair<int, int> a[101];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  int m;
  cin >> m;
  for (int i = n - 1; i >= 0; --i) {
    if (a[i].first <= m) {
      cout << n - i << endl;
      exit(0);
    }
  }
}
