#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void chkmax(T& x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
inline void chkmin(T& x, U y) {
  if (y < x) x = y;
}
const int MAXN = 1111111;
long long x[MAXN], y[MAXN];
int ans[MAXN];
long long cross(int i, int j, int k) {
  return (x[j] - x[i]) * (y[k] - y[i]) - (x[k] - x[i]) * (y[j] - y[i]);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%lld%lld", &x[i], &y[i]);
    if (x[i] <= n) ans[x[i]]++;
  }
  for (int i = 1; i <= m; i++) {
    for (int j = i + 1; j <= m; j++) {
      if (y[i] == y[j]) continue;
      long long A = y[j] * (x[i] - x[j]), B = y[i] - y[j];
      if (A % B != 0) continue;
      long long pos = x[j] - A / B;
      if (pos < 1 || pos > n) continue;
      int cnt = 2;
      for (int k = 1; k <= m; k++) {
        if (k == i || k == j) continue;
        if (cross(i, j, k) == 0) cnt++;
      }
      chkmax(ans[pos], cnt);
    }
  }
  int ret = 0;
  for (int i = 1; i <= n; i++) {
    if (ans[i] == 0) ans[i]++;
    ret += ans[i];
  }
  cout << ret << endl;
  return 0;
}
