#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long n, k, ans = 0;
pair<long long, long long> a[100000];
int32_t main() {
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first;
    cin >> a[i].second;
  }
  cin >> k;
  sort(a, a + n);
  for (long long i = 0; i < n; i++)
    if (k - 1 >= a[i].second) {
      ans++;
    }
  cout << n - ans;
  return 0;
}
