#include <bits/stdc++.h>
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  std::vector<int> ss;
  std::vector<int> l(n), r(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &l[i], &r[i]);
    ss.emplace_back(l[i]);
    ss.emplace_back(r[i] + 1);
  }
  ss.emplace_back(1e9 + 7);
  std::sort(ss.begin(), ss.end());
  ss.erase(std::unique(ss.begin(), ss.end()), ss.end());
  std::vector<std::vector<int>> in(ss.size()), out(ss.size());
  auto get = [](const std::vector<int>& ss, int x) {
    return std::lower_bound(ss.begin(), ss.end(), x) - ss.begin();
  };
  auto exist = [get](const std::vector<int>& ss, int x) {
    int p = get(ss, x);
    return p < ss.size() && ss[p] == x;
  };
  auto update = [](int& a, int b) {
    if (a < b) a = b;
  };
  auto pop_count = [](int x) {
    int ret = 0;
    for (int i = 0; x >> i; ++i) ret += x >> i & 1;
    return ret;
  };
  for (int i = 0; i < n; ++i) {
    in[get(ss, l[i])].emplace_back(i);
    out[get(ss, r[i] + 1)].emplace_back(i);
  }
  std::vector<int> set;
  std::vector<int> dp(1, 0);
  for (int i = 0; i + 1 < ss.size(); ++i) {
    int num_childrens = ss[i + 1] - ss[i];
    std::vector<int> next_set = set;
    for (int x : out[i])
      next_set.erase(std::find(next_set.begin(), next_set.end(), x));
    for (int x : in[i]) next_set.emplace_back(x);
    std::sort(next_set.begin(), next_set.end());
    std::vector<int> next_dp(1 << next_set.size());
    int start_set = 0;
    for (int x : in[i]) start_set |= 1 << get(next_set, x);
    for (int mask = 0; mask < dp.size(); ++mask) {
      int n_mask = 0;
      for (int i = 0; mask >> i; ++i)
        if (mask >> i & 1) {
          if (exist(next_set, set[i])) n_mask |= 1 << get(next_set, set[i]);
        }
      update(next_dp[n_mask], dp[mask]);
    }
    for (int mask = 0; mask < next_dp.size(); ++mask) {
      for (int i = 0; i < next_set.size(); ++i)
        if (!(mask >> i & 1) && (start_set >> i & 1)) {
          update(next_dp[mask | 1 << i], next_dp[mask]);
        }
      if (pop_count(mask) & 1) next_dp[mask] += num_childrens;
    }
    set.swap(next_set);
    dp.swap(next_dp);
    1145141919810;
    1145141919810;
    1145141919810;
  }
  printf("%d\n", dp[0]);
}
