using System; using System.IO; using System.Linq; using System.Text; using System.Diagnostics; using System.Collections.Generic; using System.Text.RegularExpressions; using Enu = System.Linq.Enumerable; class Program { void Solve() { int N = reader.Int(), M = reader.Int(), K = reader.Int(); int[][] dist = Enu.Range(0, N).Select(i => Enu.Repeat(K + 1, N).ToArray()).ToArray(); for (int i = 0; i < N; i++) dist[i][i] = 0; for (int i = 0; i < M; i++) { int a = reader.Int() - 1, b = reader.Int() - 1; dist[a][b] = dist[b][a] = 1; } for (int c = 0; c < N; c++) for (int a = 0; a < N; a++) for (int b = 0; b < N; b++) CheckMin(ref dist[a][b], dist[a][c] + dist[c][b]); long ans = 0; int[] cand = new int[N + 1]; int V = 1; var dp = new int[1 << K + 1][]; for (int r = 0; r < dp.Length; r++) dp[r] = new int[K + 1]; for (int i = N - 1; i > 0 && V <= K; i--) { cand[V++] = i; for (int r = 0; r < dp.Length; r++) for (int c = 0; c < dp[r].Length; c++) dp[r][c] = K + 1; dp[1 << 0][0] = 0; for (int visited = 0; visited < (1 << V); visited++) for (int last = 0; last < V; last++) if ((visited >> last & 1) == 1) for (int next = 0; next < V; next++) if ((visited >> next & 1) == 0) { int d = dist[cand[last]][cand[next]]; CheckMin(ref dp[visited | 1 << next][next], dp[visited][last] + d); } int minUsed = K + 1; for (int last = 0; last < V; last++) CheckMin(ref minUsed, dp[(1 << V) - 1][last]); if (minUsed <= K) ans += (1L << i) - 1; else V--; } Console.WriteLine(ans); } void CheckMin(ref int a, int b) { if (b < a) a = b; } Reader reader = new Reader(Console.In); static void Main() { new Program().Solve(); } } class Reader { private readonly TextReader reader; private readonly char[] separator = { ' ' }; private readonly StringSplitOptions removeOp = StringSplitOptions.RemoveEmptyEntries; private string[] A = new string[0]; private int i; public Reader(TextReader r) { reader = r; } public Reader(string file) { reader = new StreamReader(file); } public bool HasNext() { return Enqueue(); } public string String() { return Dequeue(); } public int Int() { return int.Parse(Dequeue()); } public long Long() { return long.Parse(Dequeue()); } public double Double() { return double.Parse(Dequeue()); } public int[] IntLine() { var s = Line(); return s == "" ? new int[0] : Array.ConvertAll(Split(s), int.Parse); } public int[] IntArray(int N) { return Enu.Range(0, N).Select(i => Int()).ToArray(); } public int[][] IntGrid(int H) { return Enu.Range(0, H).Select(i => IntLine()).ToArray(); } public string[] StringArray(int N) { return Enu.Range(0, N).Select(i => Line()).ToArray(); } public string Line() { return reader.ReadLine().Trim(); } private string[] Split(string s) { return s.Split(separator, removeOp); } private bool Enqueue() { if (i < A.Length) return true; string line = reader.ReadLine(); if (line == null) return false; if (line == "") return Enqueue(); A = Split(line); i = 0; return true; } private string Dequeue() { Enqueue(); return A[i++]; } }