#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    v.push_back(make_pair(a, b));
  }
  int k;
  cin >> k;
  int i;
  for (i = 0; i < n; i++) {
    if (k >= v[i].first and k <= v[i].second) break;
  }
  cout << n - i << endl;
}
