#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  while (cin >> n) {
    int l[n + 1], r[n + 1];
    for (int i = 0; i < n; i++) {
      cin >> l[i] >> r[i];
    }
    int num, ans;
    cin >> num;
    for (int i = 0; i < n; i++) {
      if (num >= l[i] && num <= r[i]) {
        ans = n - i;
        break;
      }
    }
    cout << ans << endl;
  }
}
