#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, mark;
  int a[105], b[105];
  while (cin >> n) {
    for (int i = 0; i < n; i++) {
      cin >> a[i] >> b[i];
    }
    cin >> k;
    for (int i = 0; i < n; i++) {
      if (k >= a[i] && k <= b[i]) {
        mark = i;
        break;
      }
    }
    cout << n - mark << endl;
  }
}
