#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, k, m, x, j;
  cin >> n;
  int a[n], b[n];
  for (i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
  }
  cin >> k;
  for (j = 1; j <= n; j++) {
    if (k >= a[j] and k <= b[j]) {
      m = (n - j) + 1;
      break;
    }
  }
  cout << m << endl;
  return 0;
}
