#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 1;
int n, m;
int x[255], y[255], sum;
int ans[maxn];
int ok(int x1, int y1, int a) {
  int res = 0;
  for (int i = 1; i <= m; i++) {
    if ((long long)y1 * (x[i] - a) == (long long)y[i] * (x1 - a)) res++;
  }
  return res;
}
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 < m; i++) {
    for (int j = i + 1; j <= m; j++) {
      long long a = (long long)x[i] * y[j] - (long long)x[j] * y[i],
                b = y[j] - y[i];
      if (b) {
        if (a % b == 0 && a / b <= n && a / b > 0) {
          a /= b;
          ans[a] = max(ans[a], ok(x[i], y[i], a));
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) sum += ans[i] ? ans[i] : 1;
  return !printf("%d\n", sum);
}
