#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int INF = 1000 * 1000 * 1000;
const int MAXM = 1 << 8;
const int MAXN = 1010 * 1010;
const double EPS = 1e-15;
int p[MAXM][2];
int cnt[MAXM * MAXM];
int ans[MAXN];
int main() {
  int N, M;
  scanf("%d%d", &N, &M);
  for (int i = 1; i <= N; ++i) {
    ans[i] = 1;
  }
  for (int i = 0; i < M; ++i)
    for (int j = 0; j < 2; ++j) {
      scanf("%d", &p[i][j]);
    }
  for (int i = 0; i + 1 < M; ++i)
    for (int j = i + 1; j < M; ++j) {
      cnt[M * i + j] = 2;
      for (int k = 0; k < M; ++k)
        if (k != i && k != j &&
            1LL * (p[k][0] - p[i][0]) * (p[i][1] - p[j][1]) ==
                1LL * (p[k][1] - p[i][1]) * (p[i][0] - p[j][0])) {
          ++cnt[M * i + j];
        }
    }
  for (int i = 0; i + 1 < M; ++i)
    for (int j = i + 1; j < M; ++j)
      if (p[i][1] != p[j][1] &&
          1LL * p[i][1] * (p[j][0] - p[i][0]) % (p[i][1] - p[j][1]) == 0) {
        long long x =
            1LL * p[i][1] * (p[j][0] - p[i][0]) / (p[i][1] - p[j][1]) + p[i][0];
        if (x >= 1 && x <= N) {
          ans[x] = max(ans[x], cnt[M * i + j]);
        }
      }
  int sum = 0;
  for (int i = 1; i <= N; ++i) {
    sum += ans[i];
  }
  printf("%d", sum);
  return 0;
}
