#include <bits/stdc++.h>
using namespace std;
const int mxn = 200001, mxk = 8;
int n, m, k;
pair<int, int> a[mxn];
int first[mxk];
int dp[1 << mxk], p[1 << mxk];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].first >> a[n + i].first;
    a[i].first--, a[i].second = i, a[n + i].second = -i;
  }
  sort(a + 1, a + 2 * n + 1);
  memset(dp, 0xcf, sizeof(dp));
  dp[0] = 0;
  for (int i = 1; i <= 2 * n; i++) {
    swap(dp, p);
    memset(dp, 0xcf, sizeof(dp));
    int x = find(first, first + k, a[i].second > 0 ? 0 : -a[i].second) - first;
    first[x] = max(0, a[i].second);
    int z = 0;
    for (int j = 0; j < k; j++) z |= !first[j] << j;
    for (int j = 0; j < (1 << k); j++)
      if (!(j & z))
        for (int l = 0; l < 2; l++) {
          dp[j] = max(dp[j],
                      p[j ^ (l << x)] + (a[i].first - a[i - 1].first) *
                                            ((__builtin_popcount(j) & 1) ^ l));
        }
  }
  cout << *max_element(dp, dp + (1 << k)) << '\n';
  return 0;
}
