#include <bits/stdc++.h>
using namespace std;
int N, X;
pair<int, int> input[101];
int main(void) {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++)
    scanf("%d %d", &input[i].first, &input[i].second);
  scanf("%d", &X);
  for (int i = 1; i <= N; i++)
    if (input[i].first <= X && X <= input[i].second) printf("%d\n", N - i + 1);
  return 0;
}
