100 10
87 73
15 71
14 33
1 4
20 80
65 67
36 36
25 4
22 21
7 97
 4 2
3 3
3 4
 5 4
3 3
4 4
5 5
1 2
 4 4
1 2
2 3
3 1
4 4
 4 3
1 1
2 3
3 4
 1000000 1
255765 255765
 4 3
1 2
2 3
4 4
 4 2
1 1
1 2
 3 3
1 1
2 2
3 3
 5 4
1 1
2 3
2 4
2 5
 4 5
1 4
3 4
1 2
2 3
2 4
 4 4
2 3
2 4
3 4
4 4
 10 9
8 10
3 10
2 8
9 3
4 8
1 10
7 9
5 4
7 3
 10 10
1 2
2 3
3 4
4 5
5 1
6 6
7 7
8 8
9 9
10 10
 5 5
1 4
3 4
1 2
2 3
2 4
 3 3
1 2
2 2
3 3
 5 3
1 1
2 2
3 3
 6 12
1 2
1 3
2 3
1 1
2 2
3 3
4 5
5 6
4 6
4 4
5 5
6 6
 4 4
1 2
2 3
1 3
4 4
 5 4
1 2
3 3
4 4
5 5
 7 13
6 7
2 7
3 7
4 3
5 2
1 4
7 7
3 1
5 5
3 3
1 5
2 6
6 6
 2 2
1 1
2 2
 5 5
1 1
2 2
3 3
4 4
5 5
 1 1
1 1
 7 3
1 1
3 3
6 6
 3 3
1 1
2 3
3 3

0 1 0 0 0 0 0 1 0 0 8 6 12 0 8 0 0 0 0 0 57 0 0 0 0 0
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Created by errorist on 17-3-25.
 */
public class GraphBoard {

    public static Graph g;
    public static Long ans = 0L;

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        int n = sc.nextInt();
        int m = sc.nextInt();

        g = new Graph(n);

        for (int i = 0; i < m; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            g.addEdge(a - 1, b - 1);
            if (a != b) {

                g.addEdge(b - 1, a - 1);
            }

        }
        new Thread(null, new Dodo(), "whatever", 1 << 26).start();
    }

    static class Dodo implements Runnable {
        public void run() {
            // Do whatever you want in this function instead of main


            ans += g.DFS(0);


            if (ans > 0)
                System.out.println(ans);
            else
                System.out.println(0);


        }
    }


    public static class Node {
        int index;
        ArrayList children = new ArrayList<Node>();

        Node(int i, int b) {
            this.index = i;
        }
    }

    public static class Graph {


        private int V;   // No. of vertices

        // Array  of lists for Adjacency List Representation
        private Node adj[];

        // Constructor
        Graph(int v) {
            V = v;
            adj = new Node[v];
            for (int i = 0; i < v; ++i)
                adj[i] = new Node(i, 3);
        }

        //Function to add an edge into the graph
        void addEdge(int v, int w) {
            adj[v].children.add(adj[w]);  // Add w to v's list.
        }

        // A function used by DFS
        void DFSUtil(int v, boolean visited[]) {
            // Mark the current node as visited and print it
            visited[v] = true;
            // System.out.print(v + " ");

            // Recur for all the vertices adjacent to this vertex
            Iterator<Node> i = adj[v].children.listIterator();
            while (i.hasNext()) {
                Node n = i.next();
                if (!visited[n.index])
                    DFSUtil(n.index, visited);
            }

        }

        // The function to do DFS traversal. It uses recursive DFSUtil()
        long DFS(int v) {
            // Mark all the vertices as not visited(set as
            // false by default in java)
            boolean visited[] = new boolean[V];

            // Call the recursive helper function to print DFS traversal
            DFSUtil(v, visited);

            for (int i = 0; i < V; i++) {
                if (!visited[i])
                    return -1;
            }
            long ans = 0;
            for (Node n : adj) {
                long s = n.children.size();
                ans += (s * (s - 1)) / 2;
            }
            return ans;
        }
    }

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
}