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