#include <bits/stdc++.h>
using namespace std;
using edge = struct {
  long long to;
  long long cost;
};
using point = struct {
  long long x;
  long long y;
};
typedef std::priority_queue<long long, std::vector<long long>,
                            greater<long long>>
    pql;
const long long MOD = 1e9 + 7;
const long long N_DIGITS = 60;
const long long INF = MOD * MOD;
const long double EPS = 1e-9;
const long double PI = 3.14159265358979323846;
std::vector<std::pair<long long, long long>> dirs = {{1, 0},   {0, 1},  {-1, 0},
                                                     {0, -1},  {1, 1},  {-1, 1},
                                                     {-1, -1}, {1, -1}, {0, 0}};
struct MaxFlow {
  struct F_edge {
    long long to, rev, capacity;
    F_edge(long long to, long long rev, long long capacity)
        : to(to), rev(rev), capacity(capacity) {}
  };
  vector<vector<F_edge>> graph;
  long long n_vertex;
  std::vector<long long> level, iter;
  MaxFlow(long long n_vertex) : n_vertex(n_vertex) { graph.resize(n_vertex); }
  void add_edge(long long from, long long to, long long capacity) {
    graph[from].push_back({to, long long(graph[to].size()), capacity});
    graph[to].push_back({from, long long(graph[from].size()) - 1, 0});
  }
  void bfs(long long source) {
    level = std::vector<long long>(n_vertex, -1);
    level[source] = 0;
    queue<long long> q;
    q.push(source);
    while (!q.empty()) {
      long long vertex = q.front();
      q.pop();
      for (long long(i) = 0; (i) < (graph[vertex].size()); (i)++) {
        long long target = graph[vertex][i].to;
        long long cap_target = graph[vertex][i].capacity;
        if (cap_target > 0 && level[target] < 0) {
          level[target] = level[vertex] + 1;
          q.push(target);
        }
      }
    }
  }
  long long dfs(long long vertex, long long sink, long long flow) {
    if (vertex == sink) return flow;
    for (long long& i = iter[vertex]; i < graph[vertex].size(); i++) {
      long long target = graph[vertex][i].to;
      long long cap_target = graph[vertex][i].capacity;
      long long rev_target = graph[vertex][i].rev;
      if (cap_target > 0 && level[vertex] < level[target]) {
        long long d = dfs(target, sink, min(cap_target, flow));
        if (d > 0) {
          graph[vertex][i].capacity -= d;
          graph[target][rev_target].capacity += d;
          return d;
        }
      }
    }
    return 0;
  }
  long long dinic(long long source, long long sink) {
    long long flow = 0;
    while (true) {
      bfs(source);
      if (level[sink] < 0) return flow;
      iter = std::vector<long long>(n_vertex, 0);
      long long f;
      while ((f = dfs(source, sink, INF)) > 0) flow += f;
    }
  }
};
class UnionFind {
  std::vector<long long> parents, set_size;

 public:
  UnionFind() {}
  UnionFind(long long n) {
    parents = set_size = std::vector<long long>(n);
    for (long long(i) = 0; (i) < (n); (i)++) {
      parents[i] = i;
      set_size[i] = 1LL;
    }
  }
  long long root_find(long long x) {
    if (parents[x] == x) return x;
    return parents[x] = root_find(parents[x]);
  }
  void unite(long long x, long long y) {
    x = root_find(x);
    y = root_find(y);
    if (x == y) return;
    if (set_size[x] < set_size[y]) {
      parents[y] = x;
      set_size[x] += set_size[y];
    } else {
      parents[x] = y;
      set_size[y] += set_size[x];
    }
  }
  bool is_same(long long x, long long y) {
    return root_find(x) == root_find(y);
  }
  long long size(long long x) { return set_size[root_find(x)]; }
};
struct BIT {
  long long n;
  std::vector<long long> tree_dat;
  BIT(long long n) : tree_dat(n + 1, 0), n(n){};
  long long update_func(long long val, long long dat) { return val + dat; }
  long long query(long long i) {
    long long ret = 0;
    for (long long j = i; j >= 0; j = (j & (j + 1)) - 1) {
      ret = update_func(ret, tree_dat[j]);
    }
    return ret;
  }
  long long lower_bound(long long key) {
    if (key <= 0) return 0;
    long long left = 0, right = 1;
    while (right <= n) right *= 2;
    for (long long i = right; i > 0; i /= 2) {
      if (left + i <= n && tree_dat[left + i - 1] < key) {
        key -= tree_dat[left + i - 1];
        left += i;
      }
    }
    return left;
  }
  void update(long long i, long long val) {
    if (i < 0) return;
    for (long long j = i; j < n; j |= j + 1) {
      tree_dat[j] = update_func(val, tree_dat[j]);
    }
  }
};
template <class Target>
class RerootingTreeDP {
 public:
  using T = typename Target::type;
  struct DP_edge {
    long long to, rev;
    T value;
  };

 private:
  long long n;
  void dfs_fwd(long long source, long long parent) {
    long long par_idx = -1;
    vector<T> values;
    for (long long(i) = 0; (i) < (tree[source].size()); (i)++) {
      const DP_edge& e = tree[source][i];
      if (e.to == parent) {
        par_idx = i;
        continue;
      }
      dfs_fwd(e.to, source);
      values.push_back(e.value);
    }
    if (par_idx != -1) {
      long long src_idx = tree[source][par_idx].rev;
      tree[parent][src_idx].value = Target::merge(values);
    }
  }
  void dfs_bwd(long long source, long long parent) {
    vector<T> values;
    for (auto&& e : tree[source]) values.push_back(e.value);
    values = Target::evaluate(values);
    for (long long(i) = 0; (i) < (tree[source].size()); (i)++) {
      const DP_edge& e = tree[source][i];
      if (e.to == parent) continue;
      tree[e.to][e.rev].value = values[i];
      dfs_bwd(e.to, source);
    }
  }

 public:
  UnionFind uf;
  vector<vector<DP_edge>> tree;
  RerootingTreeDP(long long n) : n(n), uf(n), tree(n) {}
  void add_edge(long long u, long long v, T val) {
    assert(!uf.is_same(u, v));
    tree[u].push_back({v, long long(tree[v].size()), val});
    tree[v].push_back({u, long long(tree[u].size()) - 1, val});
    uf.unite(u, v);
  }
  void dp() {
    vector<bool> visited(n, false);
    for (long long(i) = 0; (i) < (n); (i)++) {
      if (visited[uf.root_find(i)]) continue;
      dfs_fwd(i, -1);
      visited[uf.root_find(i)] = true;
    }
    visited.assign(n, false);
    for (long long(i) = 0; (i) < (n); (i)++) {
      if (visited[uf.root_find(i)]) continue;
      dfs_bwd(i, -1);
      visited[uf.root_find(i)] = true;
    }
  }
  long long size() const { return tree.size(); }
};
struct Merger {
  using type = long long;
  static vector<type> evaluate(const vector<type>& value) {
    const long long n = value.size();
    std::vector<long long> L(n + 1, 1), R(n + 1, 1);
    for (long long(i) = 0; (i) < (n); (i)++) L[i + 1] = (L[i] * value[i]) % MOD;
    for (long long(i) = n - 1; (i) >= 0; (i)--)
      R[i] = (R[i + 1] * value[i]) % MOD;
    std::vector<long long> ret(n);
    for (long long(i) = 0; (i) < (n); (i)++) ret[i] = (L[i] * R[i + 1]) % MOD;
    return ret;
  }
  static type merge(const vector<type>& value) {
    long long ret;
    for (auto&& v : value) {
    }
    return ret;
  }
};
long long gcd(long long m, long long n) {
  long long a = max(m, n);
  long long b = min(m, n);
  while (b != 1 && b != 0) {
    a %= b;
    swap(a, b);
  }
  return b == 1 ? 1 : a;
}
long long lcm(long long m, long long n) { return m / gcd(m, n) * n; }
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
long long power_mod(long long a, long long power, long long mod) {
  long long value = 1;
  while (power != 0) {
    if (power & 1) value = (value * a) % mod;
    a = (a * a) % mod;
    power = power >> 1;
  }
  return value % mod;
}
long long modinv(long long a, long long mod) {
  return power_mod(a, mod - 2, mod);
}
long long power_normal(long long a, long long power) {
  long long value = 1;
  while (power != 0) {
    if (power & 1) value = value * a;
    a = a * a;
    power = power >> 1;
  }
  return value;
}
long long comb_memo[55][55];
long long pascal_triangle(long long n) {
  comb_memo[0][0] = 1;
  for (long long(i) = (1); (i) < (n + 1); (i)++)
    for (long long(j) = 0; (j) < (i + 1); (j)++) {
      comb_memo[i][j] += comb_memo[i - 1][j];
      if (j > 0) comb_memo[i][j] += comb_memo[i - 1][j - 1];
    }
}
long long combination(long long n, long long r, long long mod) {
  if (n == r && n == 0)
    return 1;
  else if (n <= 0 || r < 0 || r > n)
    return 0;
  long long numerator = 1;
  long long denomenator = 1;
  for (long long i = 0; i < r; i++) {
    long long num = (n - i) % mod, den = (i + 1) % mod;
    (numerator *= num) %= mod;
    (denomenator *= modinv(den, mod)) %= mod;
  }
  return (numerator * denomenator) % mod;
}
long long combination_no_mod(long long n, long long r) {
  if (n == r && n == 0)
    return 1;
  else if (n <= 0 || r < 0 || r > n)
    return 0;
  long long numerator = 1;
  long long denomenator = 1;
  for (long long i = 0; i < r; i++) {
    numerator *= n - i;
    denomenator *= i + 1;
    long long g = gcd(numerator, denomenator);
    numerator /= g;
    denomenator /= g;
  }
  return numerator;
}
long double log_combination(long long n, long long r) {
  if (n == r && n == 0)
    return 0;
  else if (n <= 0 || r < 0 || r > n)
    return -INF;
  long double val = 0;
  for (long long i = 0; i < r; i++) {
    val += log(n - i);
    val -= log(i + 1);
  }
  return val;
}
long long bin_search(long long key, long long A[], long long left,
                     long long right) {
  while (right >= left) {
    long long mid = left + (right - left) / 2;
    if (A[mid] == key)
      return mid;
    else if (A[mid] > key)
      right = mid - 1;
    else if (A[mid] < key)
      left = mid + 1;
  }
  return -1;
}
string bin_expression(long long n, long long dig) {
  string s = "";
  for (long long(i) = 0; (i) < (dig); (i)++) {
    s += to_string((n % 2));
    n /= 2;
  }
  reverse((s).begin(), (s).end());
  return s;
}
long long lower_bound_bin_search_temp(long long key, long long A[],
                                      long long left, long long right) {
  if (A[left] >= key) return left;
  long long mid = left + (right - left) / 2;
  while (right >= left) {
    mid = left + (right - left) / 2;
    if (mid == left) {
      if (A[left] < key && key <= A[left + 1])
        return left + 1;
      else
        return -1;
    }
    if (A[mid - 1] < key && key <= A[mid])
      return mid;
    else if (A[mid - 1] >= key)
      right = mid - 1;
    else if (A[mid] < key)
      left = mid;
  }
  return -1;
}
long long inf_bin_search_temp(long long key, long long A[], long long left,
                              long long right) {
  if (A[left] > key) return left;
  long long mid = left + (right - left) / 2;
  while (right >= left) {
    mid = left + (right - left) / 2;
    if (mid == left) {
      if (A[left] <= key && key < A[left + 1])
        return left + 1;
      else
        return -1;
    }
    if (A[mid - 1] <= key && key < A[mid])
      return mid;
    else if (A[mid - 1] > key)
      right = mid - 1;
    else if (A[mid] <= key)
      left = mid;
  }
  return -1;
}
long long upper_bound_bin_search_temp(long long key, long long A[],
                                      long long left, long long right) {
  if (A[right] <= key) return right;
  long long mid = left + (right - left) / 2;
  while (right >= left) {
    mid = left + (right - left) / 2;
    if (mid == right) {
      if (A[right - 1] <= key && key < A[right])
        return right - 1;
      else
        return -1;
    }
    if (A[mid] <= key && key < A[mid + 1])
      return mid;
    else if (A[mid] > key)
      right = mid;
    else if (A[mid + 1] <= key)
      left = mid + 1;
  }
  return -1;
}
long long sup_bin_search_temp(long long key, long long A[], long long left,
                              long long right) {
  if (A[right] < key) return right;
  long long mid = left + (right - left) / 2;
  while (right >= left) {
    mid = left + (right - left) / 2;
    if (mid == right) {
      if (A[right - 1] < key && key <= A[right])
        return right - 1;
      else
        return -1;
    }
    if (A[mid] < key && key <= A[mid + 1])
      return mid;
    else if (A[mid] >= key)
      right = mid;
    else if (A[mid + 1] < key)
      left = mid + 1;
  }
  return -1;
}
long long bin_search_vector(long long key, std::vector<long long> v,
                            long long left, long long right) {
  while (right >= left) {
    long long mid = left + (right - left) / 2;
    if (v[mid] == key)
      return mid;
    else if (v[mid] > key)
      right = mid - 1;
    else if (v[mid] < key)
      left = mid + 1;
  }
  return -1;
}
long long lower_bound_bin_search_vector(long long key,
                                        std::vector<long long> v) {
  return lower_bound((v).begin(), (v).end(), key) - v.begin();
}
long long inf_bin_search_vector(long long key, std::vector<long long> v) {
  return lower_bound((v).begin(), (v).end(), key + 1) - v.begin();
}
long long upper_bound_bin_search_vector(long long key,
                                        std::vector<long long> v) {
  return upper_bound((v).begin(), (v).end(), key) - v.begin();
}
long long sup_bin_search_vector(long long key, std::vector<long long> v) {
  return upper_bound((v).begin(), (v).end(), key - 1) - v.begin() - 1;
}
long long fact(long long n) {
  if (n == 0) return 1;
  return n * fact(n - 1);
}
long long fact_mod(long long n, long long mod) {
  if (n == 0) return 1;
  return n * fact_mod(n - 1, mod);
}
bool is_prime(long long n) {
  if (n <= 1) return false;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
long long bool_sum(long long a1, long long a2) {
  if (a1 == 1 || a2 == 1) return 1;
  return 0;
}
std::map<long long, long long> prime_factorization(long long n) {
  long long i = 2;
  std::map<long long, long long> table;
  while (i * i <= n) {
    while (n % i == 0) {
      table[i]++;
      n /= i;
    }
    i++;
  }
  if (n > 1) table[n] = 1;
  return table;
}
std::vector<long long> divisor_table(long long n) {
  std::vector<long long> table;
  long long i = 1;
  while (i * i <= n) {
    if (n % i == 0) {
      table.push_back(i);
      if (i * i != n) table.push_back(n / i);
    }
    i++;
  }
  sort((table).begin(), (table).end());
  return table;
}
long long char_to_idx(char c) {
  long long idx = 0;
  for (char(cc) = ('a'); (cc) <= ('z'); (cc)++) {
    if (c == cc)
      return idx;
    else
      idx++;
  }
}
long long next_combination(long long sub) {
  long long x = sub & -sub, y = sub + x;
  return (((sub & ~y) / x) >> 1) | y;
}
std::vector<long long> z_algorithm(string s) {
  long long n = s.length();
  std::vector<long long> res(n);
  res[0] = n;
  long long i1 = 1, i2 = 0;
  while (i1 < n) {
    while (i1 + i2 < n && s[i2] == s[i1 + i2]) ++i2;
    res[i1] = i2;
    if (i2 == 0) {
      ++i1;
      continue;
    }
    long long i3 = 1;
    while (i1 + i3 < n && i3 + res[i3] < i2) {
      res[i1 + i3] = res[i3];
      ++i3;
    }
    i1 += i3, i2 -= i3;
  }
  return res;
}
long long big_number_mod(string s, long long mod) {
  long long l = s.length();
  long long idx = 0;
  long long val = 0;
  long long tenth = 1;
  while (idx < l) {
    long long m = long long((s[l - 1 - idx])) - long long('0');
    val += (m * tenth) % mod;
    val %= mod;
    tenth *= 10;
    tenth %= mod;
    idx++;
  }
  return val;
}
long long string_to_ll(string s) {
  long long l = s.length();
  long long idx = 0;
  long long val = 0;
  long long tenth = 1;
  while (idx < l) {
    long long m = long long((s[l - 1 - idx])) - long long('0');
    val += (m * tenth);
    tenth *= 10;
    idx++;
  }
  return val;
}
string reflected_string(string s) {
  string t, u;
  long long n = s.length();
  t = s;
  reverse((t).begin(), (t).end());
  u = t.substr((0), (n - 2) - (0) + 1) + s + t.substr((1), (n - 1) - (1) + 1);
  return u;
}
long double distance_between_point_line(point l_begin, point l_end, point p) {
  long long xl1 = l_begin.x, yl1 = l_begin.y;
  long long xl2 = l_end.x, yl2 = l_end.y;
  long long xp = p.x, yp = p.y;
  long long a = yl2 - yl1;
  long long b = -xl2 + xl1;
  long long c = -a * xl2 - b * yl2;
  return abs(long double(a * xp + b * yp + c)) /
         long double(sqrt(a * a + b * b));
}
bool is_cross(point l1_begin, point l1_end, point l2_begin, point l2_end) {
  long long x1 = l1_begin.x, y1 = l1_begin.y;
  long long x2 = l1_end.x, y2 = l1_end.y;
  long long x3 = l2_begin.x, y3 = l2_begin.y;
  long long x4 = l2_end.x, y4 = l2_end.y;
  long long val1 = (x1 - x2) * (y3 - y1) + (y1 - y2) * (x1 - x3);
  long long val2 = (x1 - x2) * (y4 - y1) + (y1 - y2) * (x1 - x4);
  long long val3 = (x3 - x4) * (y1 - y3) + (y3 - y4) * (x3 - x1);
  long long val4 = (x3 - x4) * (y2 - y3) + (y3 - y4) * (x3 - x2);
  return val1 * val2 < 0 && val3 * val4 < 0;
}
long double space_of_triangle(point p1, point p2, point p3) {
  long long x1 = p1.x, y1 = p1.y;
  long long x2 = p2.x, y2 = p2.y;
  long long x3 = p3.x, y3 = p3.y;
  long long v1 = x2 - x1;
  long long u1 = y2 - y1;
  long long v2 = x3 - x1;
  long long u2 = y3 - y1;
  long double s = long double(v1 * u2 - u1 * v2) / long double(2);
  return abs(s);
}
pair<point, long long> center_2det_of_3points(point p1, point p2, point p3) {
  long long x1 = p1.x, y1 = p1.y;
  long long x2 = p2.x, y2 = p2.y;
  long long x3 = p3.x, y3 = p3.y;
  long long c2x_2 = x2 + x1, c2y_2 = y2 + y1;
  long long c3x_2 = x3 + x1, c3y_2 = y3 + y1;
  long long b2y = x2 - x1, b2x = -y2 + y1;
  long long b3y = x3 - x1, b3x = -y3 + y1;
  long long x1_2 = c3x_2 * b3y - c3y_2 * b3x, y1_2 = c2x_2 * b2y - c2y_2 * b2x;
  long long det = -b3y * b2x + b3x * b2y;
  if (det == 0) return {{INF, INF}, det};
  long long cx_2det = -b2x * x1_2 + b3x * y1_2,
            cy_2det = -b2y * x1_2 + b3y * y1_2;
  return {{cx_2det, cy_2det}, det};
}
long long inversion_number(std::vector<long long> a, long long a_max) {
  BIT bit(a_max + 1);
  long long val = 0;
  for (long long(i) = 0; (i) < (a.size()); (i)++) {
    val += i - bit.query(a[i] - 1);
    bit.update(a[i], 1);
  }
  return val;
}
template <typename T>
vector<T> compress(vector<T> v) {
  sort((v).begin(), (v).end());
  v.erase(unique((v).begin(), (v).end()), v.end());
  return v;
}
template <typename T>
map<T, long long> dict(const vector<T>& v) {
  map<T, long long> d;
  for (long long(i) = 0; (i) < (v.size()); (i)++) d[v[i]] = i;
  return d;
}
void GaussJordanBitVector(std::vector<long long>& bs) {
  long long n = bs.size();
  long long rank = 0;
  long long j = 0;
  for (long long(i) = N_DIGITS - 1; (i) >= 0; (i)--) {
    for (j = rank; j < n; j++)
      if (bs[j] & (1LL << i)) break;
    if (j == n) continue;
    if (j > rank) bs[rank] ^= bs[j];
    for (j = rank + 1; j < n; j++) bs[j] = min(bs[j], bs[j] ^ bs[rank]);
    rank++;
  }
}
const long long MAX_N = 200005;
bool okay = false;
long long answer = 0;
long long n, a;
std::vector<long long> cnt;
void solve() {
  cnt = std::vector<long long>(65, 0);
  for (long long(i) = 0; (i) < (n); (i)++) {
    cin >> (a);
    for (long long(j) = 0; (j) < (60); (j)++)
      if (1LL << j & a) cnt[j]++;
  }
  long long base = 1;
  for (long long(j) = 0; (j) < (60); (j)++) {
    long long cnt1 = cnt[j], cnt0 = n - cnt[j];
    long long n_ones = cnt1 * cnt0;
    answer += (n_ones * base) % MOD;
    answer %= MOD;
    base *= 2;
    base %= MOD;
  }
  cout << (answer) << endl;
}
int main(void) {
  cin >> (n);
  solve();
  return 0;
}
