#include <bits/stdc++.h>
using namespace std;
int x[300];
int y[300];
int ans[1000010];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = (0); i < (n); ++i) ans[i] = 1;
  for (int i = (0); i < (m); ++i) scanf("%d%d", &x[i], &y[i]);
  for (int i = (0); i < (m); ++i) {
    for (int j = (i + 1); j < (m); ++j) {
      long long A = y[i] - y[j];
      long long B = x[j] - x[i];
      long long C = -A * x[i] - B * y[i];
      int cnt = 2;
      for (int k = (j + 1); k < (m); ++k)
        if (A * x[k] + B * y[k] + C == 0) cnt++;
      if (A != 0) {
        if ((((C > 0) ? C : -(C)) % ((A > 0) ? A : -(A))) == 0) {
          long long k = -C / A;
          if ((k >= 1) && (k <= n))
            ans[k - 1] = ((ans[k - 1] < cnt) ? (cnt) : (ans[k - 1]));
        }
      }
    }
  }
  int res = 0;
  for (int i = (0); i < (n); ++i) res += ans[i];
  cout << res << endl;
  return 0;
}
