#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int* l = new int[n];
  int* r = new int[n];
  for (int i = 0; i < n; ++i) {
    cin >> l[i] >> r[i];
  }
  int k;
  cin >> k;
  int ind = -1;
  for (int i = 0; i < n; ++i) {
    if (l[i] <= k && k <= r[i]) {
      ind = i;
      break;
    }
  }
  cout << n - ind << endl;
}
