#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000010;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const double pi = acos(-1.0);
const double eps = 1e-6;
int cnt[MAXN];
long long x[MAXN], y[MAXN];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) cin >> x[i] >> y[i];
  for (int i = 1; i <= m; i++) {
    for (int j = i + 1; j <= m; j++) {
      if (y[j] == y[i]) continue;
      long long b = x[j] - x[i], a = y[i] - y[j], c = -x[j] * a - y[j] * b;
      if (c % a) continue;
      long long xx = -c / a;
      int num = 2;
      if (xx < 1 || xx > n) continue;
      for (int k = j + 1; k <= m; k++)
        if (b * (y[k] - y[i]) == -a * (x[k] - x[i])) num++;
      cnt[xx] = max(cnt[xx], num);
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans += (cnt[i] == 0 ? 1 : cnt[i]);
  cout << ans << endl;
  return 0;
}
