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