#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    v.push_back(b);
  }
  int k;
  cin >> k;
  cout << v.end() - lower_bound(v.begin(), v.end(), k) << endl;
}
