#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1010000;
const int Maxm = 300;
const double wc = 1e-7;
int res[Maxn];
int x[Maxm], y[Maxm];
int n, m;
long long Det(long long X1, long long Y1, long long X2, long long Y2) {
  return X1 * Y2 - X2 * Y1;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) scanf("%d%d", &x[i], &y[i]);
  for (int i = 1; i <= n; ++i) res[i] = 1;
  for (int i = 1; i <= m; ++i)
    for (int j = i + 1; j <= m; ++j) {
      if (y[i] == y[j]) continue;
      double p =
          ((double)x[j] * y[i] - (double)x[i] * y[j]) / ((double)y[i] - y[j]);
      long long P = (long long)(p + wc);
      if (P < 1) continue;
      if (P > n || Det(x[i] - P, y[i], x[j] - P, y[j]) != (long long)0)
        continue;
      int cnt = 2;
      for (int k = j + 1; k <= m; ++k)
        if (Det(x[i] - x[k], y[i] - y[k], x[j] - x[k], y[j] - y[k]) ==
            (long long)0)
          ++cnt;
      res[P] = max(res[P], cnt);
    }
  int s = 0;
  for (int i = 1; i <= n; ++i) s += res[i];
  printf("%d\n", s);
  return 0;
}
