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