#include <bits/stdc++.h>
using namespace std;
int n, m;
long long x[300], y[300];
int mx[1000010];
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> x[i] >> y[i];
  for (int i = 1; i <= n; i++) mx[i] = 1;
  for (int i = 0; i < m; i++) {
    for (int j = i + 1; j < m; j++) {
      long long dx1 = x[i] - x[j];
      long long dy1 = y[i] - y[j];
      int cnt = 0;
      for (int k = 0; k < m; k++) {
        long long dx2 = x[i] - x[k];
        long long dy2 = y[i] - y[k];
        if (dx1 * dy2 == dx2 * dy1) cnt++;
      }
      if (y[i] == y[j]) continue;
      if (x[i] > 0 && x[i] <= n && x[i] == x[j]) {
        mx[x[i]] = max(mx[x[i]], cnt);
        continue;
      }
      long long xr = -y[i] * dx1 / dy1;
      long long nx = x[i] + xr;
      if (nx <= n && nx > 0 && xr * dy1 == -y[i] * dx1)
        mx[nx] = max(mx[nx], cnt);
    }
  }
  int sum = 0;
  for (int i = 1; i <= n; i++) sum += mx[i];
  cout << sum << endl;
  return 0;
}
