#include <bits/stdc++.h>
const int MAX = 100010;
const int MOD = 998244353;
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
const long double EPS = 1e-10;
const long double PI = acosl(-1.0);
using namespace std;
long long max(long long a, long long b) { return (a > b ? a : b); }
bool eq(long long a, long long b) { return fabsl(a - b) <= EPS; }
struct point {
  long long x, y;
  int id;
  point(long long x = 0, long long y = 0) : x(x), y(y) {}
  point operator+(const point &o) const { return {x + o.x, y + o.y}; }
  point operator-(const point &o) const { return {x - o.x, y - o.y}; }
  point operator*(long long t) const { return {x * t, y * t}; }
  point operator/(long long t) const { return {x / t, y / t}; }
  bool operator<(const point &o) const {
    if (!eq(x, o.x)) return x < o.x;
    return y < o.y;
  }
  bool operator==(const point &o) const { return eq(x, o.x) and eq(y, o.y); }
};
long long cross(point a, point b) { return a.x * b.y - a.y * b.x; }
bool collinear(point a, point b, point c) { return eq(cross(a - c, b - c), 0); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  long long x, y;
  vector<point> vet;
  map<int, int> bino;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    vet.push_back(point(x, y));
  }
  for (int i = 0; i < m; i++)
    for (int j = i + 1; j < m; j++)
      if (vet[i].y != vet[j].y and
          (vet[j].x * vet[i].y - vet[j].y * vet[i].x) % (vet[i].y - vet[j].y) ==
              0) {
        long long pos =
            (vet[j].x * vet[i].y - vet[j].y * vet[i].x) / (vet[i].y - vet[j].y);
        if (pos < 1 or pos > n) continue;
        int ans = 2;
        for (int k = 0; k < m; k++)
          if (k != i and k != j and collinear(vet[i], vet[j], vet[k])) ans++;
        bino[pos] = max(ans, bino[pos]);
      }
  long long resp = n;
  for (auto b : bino) resp += b.second - 1;
  cout << resp << '\n';
  return 0;
}
