#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c, x, y, z, p, m, i, j = 0;
  cin >> n;
  int arr[n * 2];
  for (i = 0; i < n; i++) {
    cin >> arr[j] >> arr[j + 1];
    j = j + 2;
  }
  cin >> x;
  for (i = 0; i < n * 2; i++) {
    if (arr[i] >= x) {
      break;
    } else {
      continue;
    }
  }
  i = i / 2;
  p = n - i;
  cout << p << endl;
  return 0;
}
