#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n;
  int L[n + 1], R[n + 1], ans = n;
  for (int i = 1; i <= n; ++i) cin >> L[i] >> R[i];
  cin >> k;
  while (k <= R[ans] && ans) ans--;
  cout << n - ans << endl;
  return 0;
}
