#include <bits/stdc++.h>
using namespace std;
void fun2(long long int a[], long long int n) {
  for (long long int i = 0; i < n; i++) cout << a[i] << " ";
  cout << "\n";
}
void fun(long long int a[], long long int n) {
  for (long long int i = 0; i < n; i++) cin >> a[i];
}
void vec(vector<long long int> &v, long long int n) {
  for (long long int i = 0; i < n; i++) {
    long long int x, z;
    cin >> x;
    v.push_back(x);
  }
}
void que(queue<long long int> &q, long long int n) {
  for (long long int i = 0; i < n; i++) {
    long long int x, z;
    cin >> x;
    q.push(x);
  }
}
void sta(stack<long long int> &v, long long int n) {
  for (long long int i = 0; i < n; i++) {
    long long int x, z;
    cin >> x;
    v.push(x);
  }
}
void sta2(stack<long long int> &v) {
  while (!v.empty()) {
    cout << v.top() << " ";
    v.pop();
  }
  cout << '\n';
}
void deq2(deque<long long int> g) {
  deque<long long int>::iterator it;
  for (it = g.begin(); it != g.end(); ++it) cout << *it << " ";
  cout << '\n';
}
void que2(queue<long long int> gq) {
  queue<long long int> g = gq;
  while (!g.empty()) {
    cout << g.front() << " ";
    g.pop();
  }
  cout << '\n';
}
void vec2(vector<long long int> &v) {
  for (auto i = v.begin(); i != v.end(); ++i) cout << *i << " ";
  cout << "\n";
}
void deq(deque<long long int> &v, long long int n) {
  for (long long int i = 0; i < n; i++) {
    long long int x, z;
    cin >> x;
    v.push_back(x);
  }
}
void vecr(vector<long long int> &v) {
  for (auto i = v.rbegin(); i != v.rend(); ++i) cout << *i << " ";
  cout << "\n";
}
void set1(set<long long int> &s, long long int &n) {
  for (long long int i = 0; i < n; i++) {
    long long int x, z;
    cin >> x;
    s.insert(x);
  }
}
void set2(set<long long int> &s) {
  for (auto i = s.begin(); i != s.end(); ++i) cout << *i << " ";
  cout << "\n";
}
long long int max(long long int a, long long int b) {
  if (a > b)
    return a;
  else
    return b;
}
long long int min(long long int a, long long int b) {
  if (a > b)
    return b;
  else
    return a;
}
long long int fac(long long int n) {
  if (n == 0)
    return 1;
  else
    return fac(n - 1) * n;
}
bool isPrime(long long int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, x, y, k;
  cin >> n;
  deque<long long int> a, b;
  for (long long int i = 0; i < n; i++) {
    cin >> x >> y;
    a.push_back(x);
    b.push_back(y);
  }
  cin >> k;
  for (long long int i = 0; i < n; i++) {
    if (k >= a[i] && k <= b[i]) cout << n - i;
  }
  return 0;
}
