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