#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
std::mt19937 rnd(
    std::chrono::high_resolution_clock::now().time_since_epoch().count());
const double PI = atan2(0.0, -1.0);
const int INF = 0x3f3f3f3f;
const ll LINF = (ll)2e18;
const int K = 8;
const int N = 100100;
class Event {
 public:
  int x, type, id;
  Event() = default;
  Event(int x, int type, int id) : x(x), type(type), id(id) {}
  bool operator<(const Event& other) const {
    return x < other.x || (x == other.x && type < other.type);
  }
};
int dp[1 << K];
bool used[K];
int idToCnt[N];
void run() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  std::vector<Event> q;
  for (int i = 0; i < n; ++i) {
    int l, r;
    scanf("%d%d", &l, &r);
    q.push_back(Event(l, 1, i));
    q.push_back(Event(r + 1, -1, i));
  }
  std::sort(q.begin(), q.end());
  std::vector<int> goodMasks;
  for (int i = 0; i < (1 << k); ++i) {
    dp[i] = -INF;
    int curMask = i;
    int cnt = 0;
    while (curMask > 0) {
      cnt += curMask % 2;
      curMask /= 2;
    }
    if (cnt % 2 == 1) {
      goodMasks.push_back(i);
    }
  }
  dp[0] = 0;
  memset(idToCnt, -1, sizeof(idToCnt));
  int prev = 0;
  for (auto i : q) {
    for (auto mask : goodMasks) {
      if (dp[mask] == -INF) {
        continue;
      }
      dp[mask] += i.x - prev;
    }
    prev = i.x;
    if (i.type > 0) {
      int cur = 0;
      while (cur < k && used[cur]) {
        ++cur;
      }
      used[cur] = true;
      idToCnt[i.id] = cur;
      for (int mask = 0; mask < (1 << k); ++mask) {
        if (((mask >> cur) & 1) == 0) {
          dp[mask ^ (1 << cur)] = dp[mask];
        }
      }
    } else {
      int cur = idToCnt[i.id];
      used[cur] = false;
      idToCnt[i.id] = -1;
      for (int mask = (1 << k) - 1; mask >= 0; --mask) {
        if (((mask >> cur) & 1) == 1) {
          dp[mask ^ (1 << cur)] = std::max(dp[mask ^ (1 << cur)], dp[mask]);
          dp[mask] = -INF;
        }
      }
    }
  }
  printf("%d\n", dp[0]);
}
int main(void) {
  auto start = std::chrono::high_resolution_clock::now();
  run();
  auto end = std::chrono::high_resolution_clock::now();
  return 0;
}
