#include "iostream"
#include "algorithm"
#include "vector"
#include "set"
#include "map"
#include "cstring"
#include "string"
#include "vector"
#include "cassert"
#include "queue"
#include "cstdio"
#include "cstdlib"
#include "ctime"
#include "cmath"
#include "bitset"
#include "unordered_map"
using namespace std;
typedef long long ll;
typedef pair < int, int > ii;
const int N = 50000 + 5;
const int K = 200;
int n, m;
bool h[N];
vector < int > v[N];
unordered_map < int, int > M[N];
int main () {
scanf("%d %d", &n, &m);
for(int i = 1; i <= m; i++) {
int x, y;
scanf("%d %d", &x, &y);
v[x].push_back(y);
v[y].push_back(x);
}
ll ans = 0;
for(int i = 1; i <= n; i++)
if(v[i].size() <= K)
for(auto x : v[i])
for(auto y : v[i])
if(x < y)
ans += M[x][y]++;
for(int i = 1; i <= n; i++) {
if(v[i].size() > K) {
for(auto x : v[i])
h[x] = 1;
for(int j = 1; j <= n; j++) {
if(j != i and (v[j].size() <= K or j < i)) {
int cnt = 0;
for(auto y : v[j])
if(y != i and h[y])
ans += cnt++;
}
}
for(auto x : v[i])
h[x] = 0;
}
}
printf("%lld\n", ans / 2);
return 0;
}
I2luY2x1ZGUgImlvc3RyZWFtIgojaW5jbHVkZSAiYWxnb3JpdGhtIgojaW5jbHVkZSAidmVjdG9yIgojaW5jbHVkZSAic2V0IgojaW5jbHVkZSAibWFwIgojaW5jbHVkZSAiY3N0cmluZyIKI2luY2x1ZGUgInN0cmluZyIKI2luY2x1ZGUgInZlY3RvciIKI2luY2x1ZGUgImNhc3NlcnQiCiNpbmNsdWRlICJxdWV1ZSIKI2luY2x1ZGUgImNzdGRpbyIKI2luY2x1ZGUgImNzdGRsaWIiCiNpbmNsdWRlICJjdGltZSIKI2luY2x1ZGUgImNtYXRoIgojaW5jbHVkZSAiYml0c2V0IgojaW5jbHVkZSAidW5vcmRlcmVkX21hcCIKCnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKdHlwZWRlZiBwYWlyIDwgaW50LCBpbnQgPiBpaTsKCmNvbnN0IGludCBOID0gNTAwMDAgKyA1Owpjb25zdCBpbnQgSyA9IDIwMDsKCmludCBuLCBtOwpib29sIGhbTl07CnZlY3RvciA8IGludCA+IHZbTl07CnVub3JkZXJlZF9tYXAgPCBpbnQsIGludCA+IE1bTl07CgppbnQgbWFpbiAoKSB7CiAgICAKICAgIHNjYW5mKCIlZCAlZCIsICZuLCAmbSk7CiAgICAKICAgIGZvcihpbnQgaSA9IDE7IGkgPD0gbTsgaSsrKSB7CiAgICAgICAgaW50IHgsIHk7CiAgICAgICAgc2NhbmYoIiVkICVkIiwgJngsICZ5KTsKICAgICAgICB2W3hdLnB1c2hfYmFjayh5KTsKICAgICAgICB2W3ldLnB1c2hfYmFjayh4KTsKICAgIH0KICAgIAogICAgbGwgYW5zID0gMDsKICAgIAogICAgZm9yKGludCBpID0gMTsgaSA8PSBuOyBpKyspCiAgICAgICAgaWYodltpXS5zaXplKCkgPD0gSykKICAgICAgICAgICAgZm9yKGF1dG8geCA6IHZbaV0pCiAgICAgICAgICAgICAgICBmb3IoYXV0byB5IDogdltpXSkKICAgICAgICAgICAgICAgICAgICBpZih4IDwgeSkKICAgICAgICAgICAgICAgICAgICAgICAgYW5zICs9IE1beF1beV0rKzsKICAgIAogICAgZm9yKGludCBpID0gMTsgaSA8PSBuOyBpKyspIHsKICAgICAgICBpZih2W2ldLnNpemUoKSA+IEspIHsKICAgICAgICAgICAgZm9yKGF1dG8geCA6IHZbaV0pCiAgICAgICAgICAgICAgICBoW3hdID0gMTsKICAgICAgICAgICAgZm9yKGludCBqID0gMTsgaiA8PSBuOyBqKyspIHsKICAgICAgICAgICAgICAgIGlmKGogIT0gaSBhbmQgKHZbal0uc2l6ZSgpIDw9IEsgb3IgaiA8IGkpKSB7CiAgICAgICAgICAgICAgICAgICAgaW50IGNudCA9IDA7CiAgICAgICAgICAgICAgICAgICAgZm9yKGF1dG8geSA6IHZbal0pCiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHkgIT0gaSBhbmQgaFt5XSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFucyArPSBjbnQrKzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmb3IoYXV0byB4IDogdltpXSkKICAgICAgICAgICAgICAgIGhbeF0gPSAwOwogICAgICAgIH0KICAgIH0KICAgIAogICAgcHJpbnRmKCIlbGxkXG4iLCBhbnMgLyAyKTsKICAgIAogICAgcmV0dXJuIDA7CiAgICAKfQ==