#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
void pre() {}
void solve() {}
vector<int> a, v;
vector<long long> dp;
vector<pair<int, pair<int, int> > > p;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  pre();
  dp.resize(300, 0);
  for (int i = 0; i < (8); ++i) a.push_back(7 - i);
  int n, m, k;
  cin >> n >> m >> k;
  v.resize(n, -1);
  p.resize(2 * n, {0, {0, 0}});
  for (int i = 0; i < (n); ++i)
    cin >> p[2 * i].first >> p[2 * i + 1].first, p[2 * i + 1].first++;
  for (int i = 0; i < (n); ++i)
    p[2 * i].second = {0, i}, p[2 * i + 1].second = {-1, i};
  sort(p.begin(), p.end());
  long long l = 1;
  set<pair<int, int> > s;
  for (int i = 0; i < (2 * n); ++i) {
    pair<int, pair<int, int> > c = p[i];
    if (c.second.first == 0) {
      assert((int)(a).size() != 0);
      v[c.second.second] = a.back();
      a.pop_back();
      for (int m = 0; m < (256); ++m)
        if (__builtin_popcount(m) % 2) {
          dp[m] += c.first - l;
        }
      for (int m = 0; m < (256); ++m)
        if (m & (1 << v[c.second.second])) {
          dp[m] = dp[m ^ (1 << v[c.second.second])];
        }
    } else {
      assert(v[c.second.second] != -1);
      a.push_back(v[c.second.second]);
      sort(a.begin(), a.end());
      reverse(a.begin(), a.end());
      for (int m = 0; m < (256); ++m)
        if (__builtin_popcount(m) % 2) {
          dp[m] += c.first - l;
        }
      for (int m = 0; m < (256); ++m)
        if (!(m & (1 << v[c.second.second]))) {
          dp[m] = max(dp[m], dp[m ^ (1 << v[c.second.second])]);
        }
      for (int m = 0; m < (256); ++m)
        if (m & (1 << v[c.second.second])) dp[m] = 0;
    }
    l = c.first;
  }
  cout << dp[0];
  return 0;
}
