#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = 3.1415926535897932384626433832795;
const string task = "";
template <class T>
T sqr(T first) {
  return first * first;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
const int nmax = 1000 * 1001;
struct line {
  long long a, b, c;
  line(){};
  line(long long a1, long long b1, long long c1) {
    a = a1;
    b = b1;
    c = c1;
  };
  line(pair<long long, long long> v, pair<long long, long long> u) {
    a = u.second - v.second;
    b = v.first - u.first;
    c = -(v.first * a + v.second * b);
  };
};
long long side(line l, pair<long long, long long> a) {
  return l.a * a.first + l.b * a.second + l.c;
}
int n, m;
int res[nmax];
pair<long long, long long> p[nmax];
int main() {
  cin >> n >> m;
  for (int i = 0; i < (int)(m); i++) cin >> p[i].first >> p[i].second;
  for (int i = 0; i < (int)(n); i++) res[i + 1] = 1;
  for (int i = 0; i < (int)(m); i++)
    for (int j = 0; j < (int)(m); j++) {
      if (i == j) continue;
      line l(p[i], p[j]);
      int cnt = 0;
      for (int k = 0; k < (int)(m); k++)
        if (side(l, p[k]) == 0) cnt++;
      int now = 1;
      if (l.c < 0) l.c *= -1, now *= -1;
      if (l.a < 0) l.a *= -1, now *= -1;
      if (l.a == 0) continue;
      if (now == 1) continue;
      if (l.c % l.a != 0) continue;
      if (l.c / l.a > n) continue;
      res[l.c / l.a] = max(res[l.c / l.a], cnt);
    }
  long long ans = 0;
  for (int i = 0; i < (int)(n); i++) ans += res[i + 1];
  cout << ans << endl;
  return 0;
}
