#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int s[100], e[100];
  int i = 0, j = 0;
  int page;
  int chr = 0;
  for (i = 0; i < n; i++) cin >> s[i] >> e[i];
  int search = 0;
  cin >> search;
  for (i = 0; i < n; i++) {
    if (s[i] == search) {
      chr = n - i;
      break;
    } else if (e[i] == search) {
      chr = n - i;
      break;
    } else if (search > s[i] && search < e[i]) {
      chr = n - i;
    }
  }
  cout << chr;
  return 0;
}
