#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a;
  int *b = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> a >> b[i];
  }
  int k;
  cin >> k;
  int m = 0;
  for (int i = 0; i < n; i++) {
    if (k > b[i])
      m++;
    else
      break;
  }
  cout << n - m;
}
