#include <bits/stdc++.h>
using namespace std;
int n, m, k;
vector<int> l, r, x, pos;
vector<vector<int>> dp, f;
void Read() {
  cin >> n >> m >> k;
  l.resize(n), r.resize(n), x.reserve(n << 1);
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    l[i]--;
    x.push_back(l[i]), x.push_back(r[i]);
  }
  sort(x.begin(), x.end());
  x.erase(unique(x.begin(), x.end()), x.end());
  f.resize(x.size());
  for (int i = 0; i < n; i++) {
    l[i] = lower_bound(x.begin(), x.end(), l[i]) - x.begin();
    r[i] = lower_bound(x.begin(), x.end(), r[i]) - x.begin();
    for (int j = l[i]; j < r[i]; j++) {
      f[j].push_back(i);
    }
  }
  pos.assign(n, -1);
  dp.assign(2, vector<int>(1 << k));
}
void Solve() {
  int cur = 0;
  for (int i = 0; i < 1 << f[0].size(); i++) {
    dp[cur][i] = (x[1] - x[0]) * __builtin_parity(i);
  }
  for (int i = 1; i < x.size() - 1; i++) {
    cur ^= 1;
    fill(dp[cur].begin(), dp[cur].end(), 0);
    for (int j = 0; j < f[i].size(); j++) {
      pos[f[i][j]] = j;
    }
    int t = 0;
    vector<int> mx(1 << k);
    function<void(int, int, int)> Dfs = [&](int x, int m1, int m2) {
      if (x == f[i - 1].size()) {
        mx[m2] = max(mx[m2], dp[cur ^ 1][m1]);
        return;
      }
      if (pos[f[i - 1][x]] == -1) {
        Dfs(x + 1, m1 | 1 << x, m2);
      } else {
        t |= 1 << pos[f[i - 1][x]];
        Dfs(x + 1, m1 | 1 << x, m2 | 1 << pos[f[i - 1][x]]);
      }
      Dfs(x + 1, m1, m2);
    };
    Dfs(0, 0, 0);
    for (int j = 0; j < 1 << f[i].size(); j++) {
      dp[cur][j] = mx[j & t] + (x[i + 1] - x[i]) * __builtin_parity(j);
    }
    for (int j = 0; j < f[i].size(); j++) {
      pos[f[i][j]] = -1;
    }
  }
  cout << *max_element(dp[cur].begin(), dp[cur].end()) << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  Read();
  Solve();
}
