#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a, b, k = 0;
  int ans = 0;
  int g[7][7];
  int arr[7];
  memset(arr, 0, sizeof(arr));
  memset(g, 0, sizeof(g));
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    g[a - 1][b - 1] = 1;
    g[b - 1][a - 1] = 1;
    arr[a - 1]++;
    arr[b - 1]++;
    ans++;
  }
  int val = 8;
  for (int k = 0; k < 7; k++) {
    if (arr[k] > 0) {
      int arr2[7];
      memset(arr2, 0, sizeof(arr2));
      for (int i = 0; i < 7; i++) {
        if (g[k][i] == 1) {
          for (int j = 0; j < 7; j++) {
            if (g[i][j] == 0) {
              arr2[j]++;
            }
          }
        }
      }
      int mx = 0;
      for (int i = 0; i < 7; i++) {
        if (arr2[i] > mx) mx = arr2[i];
      }
      if (arr[k] - mx < val) val = arr[k] - mx;
    }
  }
  if (val < 8) ans = ans - val;
  cout << ans;
  return 0;
}
