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