#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 1;
pair<int, int> chapters[101];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    chapters[i] = {l, r};
  }
  cin >> m;
  for (int i = 0; i < 101; i++) {
    if (m <= chapters[i].second) {
      cout << n - i;
      return 0;
    }
  }
}
