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