#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  vector<int> a;
  cin >> n;
  a.resize(2 * n);
  for (auto& i : a) cin >> i;
  cin >> k;
  auto i = upper_bound(a.begin(), a.end(), k);
  if (*i != k && distance(a.begin(), i)) i--;
  if (distance(i, a.end()) % 2) {
    cout << distance(i, a.end()) / 2 + 1;
  } else {
    cout << distance(i, a.end()) / 2;
  }
  return 0;
}
