#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double pi = acos(-1), eps = 1e-8;
const int maxn = 1 << 17;
const int N = 2e5 + 10, M = 2e5 + 10, mod = 998244353;
int n, m, k;
int id[N];
int L[N], R[N];
int num[N];
int w[M];
int dp[1 << 8];
map<int, int> mp;
vector<int> l[N], r[N];
set<int> s;
int b[1 << 8];
int main() {
  cin >> n >> m >> k;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &L[i], &R[i]);
    R[i]++;
    w[++cnt] = L[i];
    w[++cnt] = R[i];
  }
  sort(w + 1, w + 1 + cnt);
  int tot = 0;
  for (int i = 1; i <= cnt; i++) {
    if (w[i] != w[i - 1]) {
      mp[w[i]] = ++tot;
      num[tot] = w[i];
    }
  }
  for (int i = 1; i <= n; i++) {
    L[i] = mp[L[i]];
    R[i] = mp[R[i]];
    l[L[i]].push_back(i);
    r[R[i]].push_back(i);
  }
  int p = 1 << k;
  for (int i = 1; i < p; i++) dp[i] = -INF, b[i] = b[i >> 1] ^ (i & 1);
  for (int i = 0; i < k; i++) s.insert(i);
  for (int i = 1; i <= 2 * n; i++) {
    for (int j = 0; j < p; j++) {
      if (b[j] && dp[j] != -INF) dp[j] += num[i] - num[i - 1];
    }
    for (int j = 0; j < r[i].size(); j++) {
      int x = r[i][j];
      s.insert(id[x]);
      for (int k = 0; k < p; k++) {
        if (k & (1 << id[x])) {
          dp[k ^ (1 << id[x])] = max(dp[k ^ (1 << id[x])], dp[k]);
          dp[k] = -INF;
        }
      }
    }
    for (int j = 0; j < l[i].size(); j++) {
      int x = l[i][j];
      id[x] = *s.begin();
      s.erase(id[x]);
      for (int k = 0; k < p; k++) {
        dp[k | (1 << id[x])] = max(dp[k], dp[k | (1 << id[x])]);
      }
    }
  }
  cout << dp[0];
  return 0;
}
