#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
vector<pair<ll, ll>> a;
int main() {
  ll k, n, l, r;
  cin >> n;
  for (ll i(0); i < n; ++i) {
    cin >> l >> r;
    a.push_back(make_pair(l, r));
  }
  cin >> k;
  for (ll i(0); i < n; ++i) {
    if (a[i].second < k) continue;
    if (a[i].second >= k) {
      cout << n - i;
      return 0;
    }
  }
  return 0;
}
