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