#include <bits/stdc++.h>
using namespace std;
int getint() {
  unsigned int c;
  int x = 0;
  while (((c = getchar()) - '0') >= 10) {
    if (c == '-') return -getint();
    if (!~c) exit(0);
  }
  do {
    x = (x << 3) + (x << 1) + (c - '0');
  } while (((c = getchar()) - '0') < 10);
  return x;
}
long long n, m;
long long xs[266], ys[266];
template <class T>
T gcd(T x, T y) {
  T t;
  while (y) t = y, y = x % y, x = t;
  return x;
}
long long maxView[1 << 20];
int main() {
  int i, j, k, tcc, tc = 1 << 28;
  for (tcc = 0; tcc < tc; tcc++) {
    n = getint(), m = getint();
    for (i = 0; i < m; i++) {
      xs[i] = getint();
      ys[i] = getint();
    }
    for (i = 0; i < n; i++) maxView[i] = 1;
    for (i = 0; i < m; i++) {
      for (j = 0; j < m; j++) {
        if (ys[i] >= ys[j]) continue;
        long long dx = xs[j] - xs[i];
        long long dy = ys[j] - ys[i];
        long long dd = xs[i] * dy - dx * ys[i];
        if (dd % dy) continue;
        long long xx = dd / dy;
        if (xx <= 0 or xx > n) continue;
        long long x = xx, y = 0;
        long long cnt = 0;
        long long g = gcd(abs(dx), abs(dy));
        dx /= g, dy /= g;
        for (k = 0; k < m; k++) {
          long long ddx = xs[k] - x;
          long long ddy = ys[k] - y;
          long long d = gcd(abs(ddx), abs(ddy));
          ddx /= d, ddy /= d;
          if (ddx == dx and ddy == dy) cnt++;
        }
        maxView[x - 1] = max(maxView[x - 1], cnt);
      }
    }
    long long res = 0;
    for (i = 0; i < n; i++) res += maxView[i];
    printf("%d\n", res);
  }
  return 0;
}
