#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t n;
  cin >> n;
  int64_t a[n][2];
  for (int64_t i = 0; i < n; i++) cin >> a[i][0] >> a[i][1];
  int64_t k;
  cin >> k;
  for (int64_t i = 0; i < n; i++) {
    if (a[i][0] <= k && a[i][1] >= k) {
      cout << n - i;
      break;
    }
  }
}
