#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s, v;
  cin >> n;
  int a[2 * n];
  for (int i = 0; i < n * 2; i++) {
    cin >> v;
    a[i] = v;
  }
  cin >> s;
  for (int i = 0; i < (2 * n); i = i + 2) {
    if (s >= a[i] && s <= a[i + 1]) {
      cout << n - (i / 2);
    }
  }
}
