#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int a[N], n, m;
long long x[255], y[255];
long long gcd(long long a, long long b) { return (a == 0 ? b : gcd(b % a, a)); }
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> x[i] >> y[i];
  for (int i = 1; i <= n; i++) a[i] = 1;
  for (int i = 0; i < m; i++)
    for (int j = i + 1; j < m; j++)
      if (y[j] - y[i] != 0) {
        long long abX = fabs(x[j] - x[i] * 1.0);
        long long abY = fabs(y[j] - y[i] * 1.0);
        long long g = gcd(abX, abY);
        long long vx = (x[j] - x[i]) / g;
        long long vy = (y[j] - y[i]) / g;
        if (y[i] % vy != 0) continue;
        int cnt = 2;
        for (int k = j + 1; k < m; k++) {
          if (y[k] - y[i] == 0) continue;
          long long curAbX = fabs(x[k] - x[i] * 1.0);
          long long curAbY = fabs(y[k] - y[i] * 1.0);
          long long curG = gcd(curAbX, curAbY);
          if ((x[k] - x[i]) / curG == vx && (y[k] - y[i]) / curG == vy ||
              (x[k] - x[i]) / curG == -vx && (y[k] - y[i]) / curG == -vy)
            cnt++;
        }
        long long koef = -y[i] / vy;
        long long myX = x[i] + vx * koef;
        if (1 <= myX && myX <= n) a[myX] = max(a[myX], cnt);
      }
  int ans = 0;
  for (int i = 1; i <= n; i++) ans += a[i];
  cout << ans;
  return 0;
}
