#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> cc;
  vector<vector<int>> v;
  cc.resize(n);
  v.resize(n);
  for (int i = 0; i < n; ++i) {
    cc[i].second = 0;
    cc[i].first = i;
  }
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    v[x - 1].push_back(y - 1);
    v[y - 1].push_back(x - 1);
    ++cc[x - 1].second;
    ++cc[y - 1].second;
  }
  if (n <= 6) {
    cout << m << '\n';
  } else {
    sort(cc.begin(), cc.end(),
         [](const pair<int, int>& p1, const pair<int, int>& p2) {
           return p1.second < p2.second;
         });
    set<int> s;
    vector<int> diff;
    for (int i = 0; i < 7; ++i) {
      for (int j = 0; j < 7; ++j) {
        for (int k = 0; k < v[i].size(); ++k) {
          s.insert(v[i][k]);
        }
        for (int k = 0; k < v[j].size(); ++k) {
          s.insert(v[j][k]);
        }
        diff.push_back(v[i].size() + v[j].size() - s.size());
        s.clear();
      }
    }
    sort(diff.begin(), diff.end());
    cout << m - diff[0] << '\n';
  }
  return 0;
}
