#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 10;
const int M = 1000000007;
const long double eps = 1e-9;
const long double PI = acos(-1);
const int oo = 1000000000;
struct point {
  int x, y;
  point() : x(0), y(0) {}
  point(int a, int b) {
    x = a;
    y = b;
  }
  point operator+(const point &p) const { return point(x + p.x, y + p.y); }
  point operator-(const point &p) const { return point(x - p.x, y - p.y); }
  bool operator==(const point &p) const { return x == p.x && y == p.y; }
  void scan() { scanf("%d%d", &x, &y); }
  long double len() { return sqrt(x * x + y * y); }
  long double dist(const point &p) const { return (p - *this).len(); }
  int operator*(const point &p) const { return x * p.x + y * p.y; }
  int operator^(const point &p) const { return x * p.y - y * p.x; }
  long double linePointDist(point a, point b, bool seg = false) {
    point c = *this;
    if (seg) {
      if ((b - a) * (c - b) > 0) return b.dist(c);
      if ((a - b) * (c - a) > 0) return a.dist(c);
    }
    return abs((b - a) ^ (c - a)) / a.dist(b);
  }
  void rotate(long double theta, point Z = point(0, 0)) {
    int ox = x - Z.x;
    int oy = y - Z.y;
    x = ox * cos(theta) - oy * sin(theta) + Z.x;
    y = ox * sin(theta) + oy * cos(theta) + Z.y;
  }
};
long double areaOfTri(point a, point b, point c) {
  point x = b - a;
  point y = c - a;
  return (x ^ y) / 2.0;
}
long double areaOfPolygon(vector<point> &P) {
  int area = 0;
  for (int i = 1; i < P.size() - 1; ++i)
    area += (P[i] - P[0]) ^ (P[i + 1] - P[0]);
  return abs(area / 2.0);
}
bool collinear(point a, point b, point c) { return areaOfTri(a, b, c) == 0; }
int n, m;
vector<point> v;
vector<int> ans;
long double slope(point &a, point &b) {
  if (a.x == b.x) return 1e9;
  return ((long double)b.y - a.y) / (b.x - a.x);
}
int main() {
  cin >> n >> m;
  v.resize(m);
  ans.resize(n + 1, 1);
  for (int i = 0; i < m; ++i) v[i].scan();
  for (int i = 0; i < m; ++i) {
    map<long double, int> mp;
    for (int j = 0; j < m; ++j) {
      if (j == i) continue;
      ++mp[slope(v[i], v[j])];
    }
    for (auto it : mp) {
      long double M = it.first;
      int ct = it.second;
      if (!M) continue;
      if (M == 1e9) {
        int dd = v[i].x;
        if (dd >= 1 && dd <= n) ans[dd] = max(ans[dd], ct + 1);
        continue;
      }
      long double c = v[i].y - M * v[i].x;
      long double dd = -c / M;
      int xx = dd + eps;
      if (dd - eps > n || dd + eps < 1 || min(dd - xx, xx + 1 - dd) > eps)
        continue;
      ans[xx] = max(ans[xx], ct + 1);
    }
  }
  int sum = 0;
  for (int i = 1; i <= n; ++i) sum += ans[i];
  cout << sum << endl;
  return 0;
}
