#include <bits/stdc++.h>
using namespace std;
struct Pair {
  int first = 0;
  int second = 0;
};
int main() {
  int n, b, i = 0;
  cin >> n;
  Pair a[n + 1];
  for (i = 1; i <= n; i++) cin >> a[i].first >> a[i].second;
  cin >> b;
  for (i = 1; i <= n; i++) {
    if (b >= a[i].first && b <= a[i].second) {
      cout << n - i + 1;
      return 0;
    }
  }
  cout << 0;
}
