#include <bits/stdc++.h>
using namespace std;
int N;
pair<int, int> P[105];
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> P[i].first >> P[i].second;
  int K;
  cin >> K;
  for (int i = 1; i <= N; i++)
    if (K >= P[i].first && K <= P[i].second) {
      cout << N - i + 1 << "\n";
      return 0;
    }
  return 0;
}
