#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, k;
  cin >> n;
  vector<int> l(n + 1);
  vector<int> r(n + 1);
  for (i = 1; i <= n; i++) cin >> l[i] >> r[i];
  cin >> k;
  for (i = 1; i <= n; i++)
    if (l[i] <= k && k <= r[i]) {
      cout << n - i + 1;
    }
  getchar();
  getchar();
  return 0;
}
